微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

编辑 HOCON 文件时保留点符号

如何解决编辑 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 举报,一经查实,本站将立刻删除。