Using environment variables in Ini files
|Assignee:||Jan Dolinár||% Done:|
It is sometimes useful to specify things in config based on current environment, e.g. paths can contain $HOME variable to make default config usable for all users.
Enclosed patch allows replacing such variables by their values. To keep things backwards compatible, this feature must be enabled explicitly by '@replace-env' in the config file. It can be also turned of again with @ignore-env. This allows to use this for only specific parts of configuration. When in the replacing mode, "$$" can be used to escape literal "$".
test1=$HOME/test1 @replace-env test2=$HOME/test2 test3=text containing $$ @ignore-env test4=$HOME/test3This produces:
Config::test1 = $HOME/test1 Config::test2 = /home/h/test2 Config::test3 = text containing $ Config::test4 = $HOME/test3
#1 Updated by Miroslav Fidler over 9 years ago
- Status changed from Patch ready to Approved
- Assignee changed from Miroslav Fidler to Jan Dolinár
Thanks, very much liked here :)