Closed EtcetFelix closed 3 months ago
I can't reproduce this on master or on 2.3:
~/PycharmProjects/omegaconf (2.3_branch)
$ python test.py
{'host': '${oc.env:REDIS_HOST,default_host}'}
default_host
done
(hydra)
omry@GameStation MINGW64 ~/PycharmProjects/omegaconf (2.3_branch)
$ ipython
Python 3.11.9 | packaged by Anaconda, Inc. | (main, Apr 19 2024, 16:40:41) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.26.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import omegaconf
In [2]: omegaconf.__version__
Out[2]: '2.3.0'
Describe the bug When using the built in interpolation resolver
oc:env
with a default value, the resolution is an empty string when the environment variable doesn't exist or is empty.To Reproduce I've attached the files to reproduce the issue below but here is the code:
REDIS_HOST is not set in the environment on purpose.
Zip file with everything related to reproduce the issue: testingOcEnvEmptyDefaultBug.zip
Expected behavior According to the documentation:
The expectation is that the output of the interpolation resolution is the default value. In this case, the output of config.host should be the string 'default_host'
Additional context