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 error when including? #306

Closed
0xdevalias opened this issue Apr 8, 2015 · 4 comments · Fixed by #307
Closed

Substitution error when including? #306

0xdevalias opened this issue Apr 8, 2015 · 4 comments · Fixed by #307

Comments

@0xdevalias
Copy link

I have:

  • application.conf
  • reference.conf
  • reference.foo.conf (which is 'root' included in reference.conf (not into another key))

In reference.foo.conf I have keys application.server.protocol, application.server.host, application.server.port, which are then referenced from the same file to build up email text in application.foo.email.body using substitutions. This key is a multiline text field, with the substitutions using the 'unquoted string concat' method, eg.

application.foo.email.body = """
Some stuff
Happens
Here"""${application.server.protocol}"://"${application.server.host}${application.server.port}"""
Then we do some more stuff"""

The substitutions work fine when i make the changes to the keys in reference.foo.conf, but if I try and override them in application.conf, the email text still contains the original values from reference.foo.conf

My understanding of how the overlays work, and how substitution happens after all overlays, I would have expected this to work properly.

Is this a bug in config, or am I just doing something wrong somewhere along the way?

Thanks!!

@havocp
Copy link
Collaborator

havocp commented Apr 8, 2015

All reference.conf files are resolved standalone, and then all application.conf are combined with the result and then the combination is resolved again. So reference.conf can't refer to application.conf, essentially. There's more discussion on #167

A possible workaround is to put an application.conf in your library along with the reference.conf, containing those things that should be processed as part of application.conf.

@0xdevalias
Copy link
Author

I may have been unclear, I'm not including anything in application.conf I'm using it in the 'proper' manner, eg. it will automagically override any keys that are set in reference files.

reference.conf is including reference.foo.conf
application.conf is attempting to override some default keys set in the references

Edit: Should have clicked your link before commenting.. Will read that thread. Though if that's how things work, then the description text in the README probably needs to be updated, as it implies otherwise.

@havocp
Copy link
Collaborator

havocp commented Apr 8, 2015

what is the specific text that was misleading in the readme? I'll fix it up.

@0xdevalias
Copy link
Author

Was just looking for that now, but it seems there was no one real bit, but rather a combination of how the standard behaviour and substitutions are described.

Maybe some kind of note in the substitution part, highlighting the thread you linked, and/or the quirks of includes/substitutions would be cool.

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.

2 participants