We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好:
有 2 个命名空间,application 与 application2,根据 apollo 官方说明,当引入 application2 时应该会默认覆盖 application 的配置项, 目前是无效的。
public TestController(ITokenService tokenService, IConfiguration configuration, IOptionsMonitor<LiuXueOptions> options) { _tokenService = tokenService; _secret = options.CurrentValue.LiuXueAdminAPISecret!; _configuration = configuration; } public IActionResult Index() { var env = _configuration["Env"]; // "Namespaces": [ "application2", "application" ] // "Namespaces": [ "application", "application2" ] // 始终返回:env: DEV // 即:application2 的配置,无法覆盖默认 application 的配置项的值。 return Content("env: " + env); }
The text was updated successfully, but these errors were encountered:
调试时看看_configuration的Providers属性值的顺序,以及相应的两个Provider的Data属性值
Sorry, something went wrong.
你好,目前配置中心注册了 3 个 provider,第1个 provider 值 为 UAT,第 3 个 provider 值为 DEV
无论是否调整 namespaces 顺序,provider 始终都是如此。请看图。
"Apollo": { "AppId": "", "Secret": "", "MetaServer": "", "Namespaces": [ "application", "application.json", "application2" ] }
感谢,问题应该排查到了,这里在添加 apollo 时,又进行 .AddDefault() 添加了默认的命名空间导致的。
No branches or pull requests
你好:
有 2 个命名空间,application 与 application2,根据 apollo 官方说明,当引入 application2 时应该会默认覆盖 application 的配置项,
目前是无效的。
The text was updated successfully, but these errors were encountered: