Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chained duplicate overrides return incorrect value of "None" #323

Open
coreycdm opened this issue Feb 22, 2024 · 0 comments
Open

Chained duplicate overrides return incorrect value of "None" #323

coreycdm opened this issue Feb 22, 2024 · 0 comments

Comments

@coreycdm
Copy link

Description

We stumbled across an issue the other day and confirmed the bug a couple of different ways. The bottom line is that when there is more than one override for a value (e.g. a default value, and then an optional override using an environment variable, and then an optional override using a DIFFERENT environment variable), if the environment variable is missing, we lose the default value and the config value will resolve to Python "None".

This is important for our use case since we use client-specific config overrides to allow us to be able to adapt to different environment variable in different environments (but sometimes we don't need the client override).

Examples

Simple example

This first example is the most basic I could break it down to: having two different optional environment variables in one config. This isn't our actual use case, but illustrates the problem succinctly:
image
With none of the optional environment variables set, you can see the 'password' evaluates to none. Expected result is that 'password' should be the default of "123.

This works properly/as expected if we have EITHER environment variable or BOTH environment variables set:
image

Our actual use case example

Our actual use case is that we have a default value set in reference.conf, with an optional override if our standard environment variable is set. We then have a client-specific config that we can use to override the reference.conf values, and have that set as optional as well. Our expected/desired outcome is that we'd use the client-specific environment variable if available; if not, we'd use the standard environment variable. Failing those, we should use the default value.

Below, you can see the setup. The parsed config is returning "None" for password in the situation where we don't have either of the optional environment variable set, but our expected value would be the default of "abc":
image

I have confirmed this issue occurs in versions 0.3.59 and 0.3.60.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant