Add functionality to fetch a slice of used environment variables in config
saturn4er opened this issue · 1 comments
saturn4er commented
In some cases, it's useful to be able to retrieve all the possible configurations of an application. To address this, it would be great to have a feature that allows fetching a slice of used environment variables in the config.
This feature will enable the ability to print a list of available configs for an application or to create a .env file template.
I propose adding the following struct, which represents an environment parameter:
type EnvParameter struct{
EnvVariable string
DefaultValue string
Required bool
NotEmpty bool
Unset bool
ReadFromFile bool
}
The implementation should provide a function to collect all the environment variables used in the config and return a slice of EnvParameter structs, containing the necessary details about each variable.