ConfigArgParse icon indicating copy to clipboard operation
ConfigArgParse copied to clipboard

Parse environment variables in config file

Open netw0rkf10w opened this issue 5 years ago • 2 comments

I would like to know if there's a way to use environment variables in a config file. In the following example, $HOME and $CUDA will not be converted to the corresponding values:

data-dir=$HOME/data
cuda-dir=$CUDA

Thank you very much in advance for your help!

netw0rkf10w avatar Apr 11 '20 13:04 netw0rkf10w

This is not currently supported. It's non-trivial to add this behavior in a robust way.

bw2 avatar Feb 14 '21 22:02 bw2

or it might not be that difficult. If you still need this, please submit a PR, adding an option to the ArgParser constructor to enable this behavior (since enabling it by default might break existing config files). Then run os.path.expandvars() on config file value strings.

bw2 avatar Feb 15 '21 14:02 bw2