Feature #540

Using environment variables in Ini files

Added by Jan Dolinár over 10 years ago. Updated over 10 years ago.

Status:ApprovedStart date:10/13/2013
Priority:NormalDue date:
Assignee:Jan Dolinár% Done:

100%

Category:CoreSpent 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/test3
This produces:
Config::test1 = $HOME/test1
Config::test2 = /home/h/test2
Config::test3 = text containing $
Config::test4 = $HOME/test3

Ini.diff Magnifier (1.38 KB) Jan Dolinár, 10/13/2013 04:45 PM

History

#1 Updated by Miroslav Fidler over 10 years ago

  • Status changed from Patch ready to Approved
  • Assignee changed from Miroslav Fidler to Jan Dolinár

Thanks, very much liked here :)

Also available in: Atom PDF