Closed ZeroSong211 closed 9 months ago
🤖
Hello @ZeroSong211,
I'm Dosu, a bot here at the apollo repository. I'm capable of helping you solve bugs, answer questions, and even guide you to become a contributor. While you wait for a human maintainer, I'm here to assist you.
Rest assured, I'm currently reviewing your issue and will provide you with a comprehensive response shortly.
🤖
根据我在Apollo仓库中的查找,我没有找到关于环境变量覆盖配置时,键中包含"-"字符会失败的相关信息。Apollo配置管理系统通过在属性文件中使用占位符来处理环境变量。这些占位符由${<variable_name>}
语法表示。
例如,在提供的上下文中,dev.meta=${dev_meta}
意味着在运行时,dev.meta
属性将被dev_meta
环境变量的值替换。
这允许Apollo根据其运行的环境动态调整其配置,无需更改代码或重新编译应用程序。你可以在这个链接中查看相关的代码:apollo-portal/src/main/resources/apollo-env.properties
关于你提到的问题,我建议你提供更多的信息,例如你的环境变量和配置的具体情况,以及你在尝试覆盖配置时遇到的具体错误。这将有助于我更好地理解和解答你的问题。
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
不是同一种情况,还请人工帮忙看一下,感谢~
@nobodyiam, I could use your expertise on this one.
经过多次测试,不是带"-"的key覆盖失败,而是key-value左右值不相等才会覆盖失败,改成如下图格式后,环境变量是可以进行覆盖的(ps:也就是说想要用环境变量去覆盖apollo的配置,就必须保持key-value左右值相等。。)。
@ZeroSong211 这个是 spring 自身的配置规则,简而言之 test.param.enable-test 等同于环境变量 TEST_PARAM_ENABLE_TEST,两个都是 KEY,不是 value。
TEST_PARAM_ENABLE_TEST打错了吧。。应该是TEST_PARAM_ENABLE-TEST
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.
描述bug
多个应用引用同一个apollo配置时,不同应用间的配置差异我们采用了环境变量去覆盖apollo配置。但使用过程中,发现key中带"-"的配置使用此方式覆盖失败。
复现
通过如下步骤可以复现:
期望 配置应该被覆盖为true
截图
如果可以,附上截图来描述你的问题
额外的细节和日志