nacos We want to modify the configuration for a key in the content

bbmckpt7  于 5个月前  发布在  Nacos
关注(0)|答案(2)|浏览(108)

We have a requirement to adjust the configuration through full automation. Page operations are illegal for us, so we need to update the configuration of a certain change through curl requests. However, the open API provided by Nacos can only be fully changed, which means we need to submit the configuration file in full. However, our configuration is too large, which will require us to add a lot of verification work. We hope to add an open API for modifying a single key. If necessary, we can submit a PR to update this feature ourselves.
我们有一个需求,需要通过全自动化调整配置,页面操作在我们这里是非法的,所以我们需要通过curl请求来更新某一个变更的配置,但是nacos提供的openapi只能全量更改,这就意味着我们需要全量提交配置文件才可以,但是我们的配置太多了,这会让我们增加大量的核对工作,希望可以增加单个key修改的openapi,如果有需要我们可以自己提交PR来更新这个功能。
This way, the problem can be reproduced.
这样就可以复现这个问题。

namespace: cdlgroup: DEFAULT_GROUP
dataId: test.yml

Configuration items in the file:
文件中配置项:

c1: test1
c2: test2

c1: test1 -> c1: newTset
http://ip:8848/nacos/v1/cs/configs?dataId=test.yml&group=DEFAULT_GROUP&type=yaml&username=nacos&password=nacos&content=c1%3A%20newTest

After calling the above APIs, configure as follows:
调用以上api后,配置如下:
c1: newTset

The remaining configurations have been cleared and cannot be modified for a single target configuration.
其余配置被清理,无法修改单个目标配置。

yzuktlbb

yzuktlbb1#

  1. nacos本身不会去解析配置文件,所以不会支持这个能力
  2. 如果是全自动化调整配置,你们自己可以接入nacos-client,在程序内做解析对比,类似封装一层解析
  3. 单key有点类似开关平台的意思了,@KomachiSion 社区有建设switch的意向吗,我理解依赖在nacos config上层来做的话不是很复杂了
cidc1ykv

cidc1ykv2#

建设类似switch的功能其实也是要解析配置文件的, 还是和nacos自身能力相悖。如果是单dataid一个开关的话, 倒是可以考虑,一方面看后续社区需求,一方面看dataid的膨胀数量。

相关问题