refactor: 删除 PropertyEnvConfigSource,env-config 数据源由平台默认挂载文件源兜底(yh-env-config starter B2 下沉)
ci-userbase-service / build-and-push (push) Failing after 49s
ci-userbase-service / build-and-push (push) Failing after 49s
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
package com.yunhai.userbase.service.impl;
|
|
||||||
|
|
||||||
import com.yunhai.platform.envconfig.EnvConfigSource;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* env-config 数据源实现:整站已停用 nacos 配置中心,改为从 Spring Environment 读取静态属性。
|
|
||||||
* 键 = {@code yh.env-config.source.<target>},三处可配(优先级由 Environment 决定):
|
|
||||||
* 1) 启动参数 --yh.env-config.source.front='{...}'
|
|
||||||
* 2) 环境变量 YH_ENV_CONFIG_SOURCE_FRONT(projman .env / Gitea Secrets 注入,宽松绑定)
|
|
||||||
* 3) application.yml 内 yh.env-config.source.front 键
|
|
||||||
* 未配置返回 null,平台 EnvConfigService 会归一为 "{}" 返回(前端走同源推断兜底,接口保持 200)。
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class PropertyEnvConfigSource implements EnvConfigSource {
|
|
||||||
|
|
||||||
private static final String KEY_PREFIX = "yh.env-config.source.";
|
|
||||||
|
|
||||||
private final Environment environment;
|
|
||||||
|
|
||||||
public PropertyEnvConfigSource(Environment environment) {
|
|
||||||
this.environment = environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String get(String target) {
|
|
||||||
return environment.getProperty(KEY_PREFIX + target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user