zio / zio-config

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

`constant` and `constantString` could be in `ConfigDescriptors` #454

Open vigoo opened 3 years ago

vigoo commented 3 years ago

This came up in a discussion of https://github.com/vigoo/zio-aws/issues/144 and I wanted to move this topic here.

I believe the DerivationUtils.constant and DerivationUtils.constantString would be useful outside the derivation implementation too, so it could be moved to ConfigDescriptors where the other config descriptor constructors are.

More generally I think the derivation should be just an optional convenience tool and everything it does should be possible to do by the users by hand. Here this is somewhat true because the above mentioned descriptor can be implemented in user code but its not that straightforward as it needs a custom property type.

afsalthaj commented 3 years ago

Thanks @vigoo for moving the discussion here. Yes constants could be part of ConfigDescriptor. Agreed :)

We will continue working over this feature right after our 1.0 release. And I can see 1.0.1 would have semantics related to “constant” in “ConfigDescriptorModule”.

afsalthaj commented 3 years ago

Hi @vigoo I think, as a next step, Description needs to hold the information about type, constants, default separately. As of now its a comma separated string in a List.

This actually goes in line with this ticket. What do you think?