thesimj / envyaml

Simple YAML configuration file parser
MIT License
78 stars 21 forks source link

Allow reading file after filling variables #44

Open TahreemSaleem opened 2 years ago

TahreemSaleem commented 2 years ago

Is your feature request related to a problem? Please describe. After the library reads the yaml file and fill the variables from environment, it just puts all the env variables and yaml keys in a single dict and provide no option to just read the modified contents of the yaml file. This can cause issues for example when one wants to use the library to fill the variables in yaml and dump the contents to another file.

Describe the solution you'd like Separately exposing the contents of the file will allow the user to achieve this. Internally the contents of the environment and contents of the file can be held in separate variables. The get function can then have two options: it can first read the variable holding the file contents if not found it searches in environment. Second option is to split the get function to provide getter for env and file contents separately.