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

Substitution fails for nested sections #321

Closed
M0dEx opened this issue Jan 17, 2024 · 0 comments · Fixed by #322
Closed

Substitution fails for nested sections #321

M0dEx opened this issue Jan 17, 2024 · 0 comments · Fixed by #322

Comments

@M0dEx
Copy link
Contributor

M0dEx commented Jan 17, 2024

Description

Hi!

We have come across an issue where pyhocon is unable to resolve a nested substitution that should be resolvable, according to the HOCON specification.

Example

base.conf:

foo {
  foo-inner {
    pre-foo = 1
    foo-sub = ${foo.foo-inner.pre-foo}${foo.foo-inner.bar}
  }
}

bar {
  bar-inner {
    foo-sub = ${foo.foo-inner.foo-sub}
  }
}

child.conf:

include required("base.conf")

foo {
  foo-inner {
    bar = 1
  }
}

Expected result

foo {
  foo-inner {
    pre-foo = 1
    foo-sub = 11
    bar = 1
  }
}

bar {
  bar-inner {
    foo-sub = 11
  }
}

Actual result

pyhocon.exceptions.ConfigSubstitutionException: Cannot resolve ${foo.foo-inner.foo-sub}: (line: 10, col: 15). Check for cycles.

If the variables are moved from (foo/bar)-inner to (foo/bar), the substitution works as expected.

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

Successfully merging a pull request may close this issue.

1 participant