Feature #540
Using environment variables in Ini files
Status: | Approved | Start date: | 10/13/2013 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | Jan Dolinár | % Done: | 100% | |
Category: | Core | Spent time: | - | |
Target version: | - |
Description
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 "$".
Example:
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
History
#1 Updated by Miroslav Fidler over 11 years ago
- Status changed from Patch ready to Approved
- Assignee changed from Miroslav Fidler to Jan Dolinár
Thanks, very much liked here :)