编辑 HOCON 文件时保留点符号

问题描述

我正在使用 pyhocon.(https://github.com/chimpler/pyhocon) 创建一个 hocon conf 文件

我正在尝试使用标准 hocon 文件构建 hocon 文件,更新必要的值并上传更新后的文件

deployment {
      proxy {
        // Name has to be replaced with the name of the project
        cluster.TEST {
          property1 = [a_list]
          property2.host = "hostname"
        }
      }
    }

我可以使用 pyhocon 更新值:

from pyhocon import ConfigFactory


conf = ConfigFactory.parse_string(hocon_file_template)
host = "something-TEST.trial.com"
conf.put('deployment.proxy.cluster.TEST.property2.host',host)
new = HOCONConverter.convert(conf,"hocon")

但是,转换后的文件去掉了点符号并输出

deployment {
      proxy {
        // Name has to be replaced with the name of the project
        cluster {
         TEST {
                 property1 = [a_list]
                 property2.host = "hostname"
          }
        }
      }
    }

如何以点表示法维护属性

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)