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

Inheritance breaks configuration file overlays #812

Open
danielyli opened this issue Dec 10, 2024 · 0 comments
Open

Inheritance breaks configuration file overlays #812

danielyli opened this issue Dec 10, 2024 · 0 comments

Comments

@danielyli
Copy link

Typesafe config version: 1.4.3

Summary

When a configuration object uses inheritance, non-optional environment variables are searched for before further file overlays are applied, which breaks file overlays.

Reproduction Steps

Create the following two configuration files:

File: src/main/resources/application.conf

base = {}
child = ${base} {
  foo = ${FOOBAR}
}

File: src/test/resources/application.conf

child.foo = "test-foo"

When attempting to run sbt test, the following error will appear:

Caused by: sbt.ForkMain$ForkError: com.typesafe.config.ConfigException$UnresolvedSubstitution:
application.conf @ file:/[...]/target/scala-2.13/classes/application.conf: 248: Could not resolve
substitution to a value: ${FOOBAR}

In contrast, if we change src/main/resources/application.conf to be the following, the error does not appear and child.foo is correctly set to test-foo:

child = {
  foo = ${FOOBAR}
}

Expected Behavior

The configuration value for child.foo should be test-foo for both cases.

Actual Behavior

Inheritance breaks the first case.

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