zio / zio-config

Easily use and document any config from anywhere in ZIO apps
https://zio.dev/zio-config
Apache License 2.0
231 stars 112 forks source link

Write back to Yaml similar to writing back to Json #404

Open afsalthaj opened 4 years ago

afsalthaj commented 4 years ago

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 commented 2 years ago

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.

l0kr commented 2 years ago

I'll work on this one

afsalthaj commented 2 years ago

Thanks @co0lster