zio-config icon indicating copy to clipboard operation
zio-config copied to clipboard

Write back to Yaml similar to writing back to Json

Open afsalthaj opened this issue 4 years ago • 3 comments

We have a zio.config.typesafe package that can write back any config description to Json. We need the similar functionality for yaml, as currently zio-config can only read yaml, and cannot write back to yaml.

This will also turn out to be a simple tool for users to convert json to its yaml representation

afsalthaj avatar Sep 19 '20 02:09 afsalthaj

Here are the example steps required to write a config back to its source.

  1. For typesafe-hocon config, we built a function that goes from propertyTree to `com.typesafe.config.Config,

https://github.com/zio/zio-config/blob/master/typesafe/shared/src/main/scala/zio/config/typesafe/TypesafeConfigSource.scala#L226

  1. Similary we need a function that goes from PropertyTree to YamlConfig.

This means you can imagine every config in various libraries can be turned to a PropertyTree.

afsalthaj avatar Oct 30 '21 14:10 afsalthaj

I'll work on this one

l0kr avatar Oct 30 '21 14:10 l0kr

Thanks @co0lster

afsalthaj avatar Oct 30 '21 14:10 afsalthaj