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

Changes to application.conf are not picked up on Debian #1135

Closed
jkransen opened this issue Jun 29, 2018 · 3 comments
Closed

Changes to application.conf are not picked up on Debian #1135

jkransen opened this issue Jun 29, 2018 · 3 comments

Comments

@jkransen
Copy link

jkransen commented Jun 29, 2018

Expected behaviour

Changes to /etc/fijnstof/application.conf are picked up by application.

Actual behaviour

Configuration items remain the same.

Information

I have this section in my build.sbt:

mappings in Universal += {
  // we are using the reference.conf as default application.conf
  // the user can override settings here
  val conf = (resourceDirectory in Compile).value / "reference.conf"
  conf -> "conf/application.conf"
}

I can build a .deb using sbt debian:packageBin, and install it.

I see a application.conf appear in /etc/fijnstof/, which I can edit.

When starting the app, changes to this file are not picked up however. I tried excluding the original application.conf from the package (or even from the repo), but to no avail.

If you want more context, please have a look at https://github.com/jkransen/fijnstof/, it can also be used to reproduce the issue.

@muuki88
Copy link
Contributor

muuki88 commented Jun 30, 2018

Hi @jkransen
Thanks for your detailed report and the sample project. There are multiple options to this.

  • conf/* is not on the classpath, which is why things aren't picked up. You can check with either sbt show scriptClasspath or take a look at the generated by script
  • use the etc configuration option and set the typesafe config file java system property

@jkransen
Copy link
Author

jkransen commented Jul 1, 2018

Hi @muuki88 , I'm glad you responded. Can you elaborate a bit more on your answer? It was your example I followed: https://github.com/muuki88/sbt-native-packager-examples/blob/master/application-conf/build.sbt which does not seem to do either of your options. What is a generated by script?

sbt> show scriptClasspath

shows all dependency jars, and on top the app itself. By the way, I run it (and generate the .deb) on a host computer, which is not the one the .deb is being installed on.

@muuki88
Copy link
Contributor

muuki88 commented Jul 1, 2018

No worries @jkransen .

Your package is configured fine, but you have to configure the lightbend config library as well. The lightbend config library looks
for a predefined set of configurations file on your classpath or at a configured path.
Make sure to understand how lightbend typesafe config loading works before applying
one of the solutions.

Configure config.file parameter

Hidden in this documentation example you see how to add the -Dconfig.file parameter to your bash start script:

// add jvm parameter for typesafe config
bashScriptExtraDefines += """addJava "-Dconfig.file=${app_home}/../conf/app.config""""

Adding conf to the classpath

Solution one I mentioned was adding the conf folder to your classpath. I'm not sure if this works, but the idea is to add the conf/application.conf file to the classpath. The bash start script only adds things in the lib folder to the classpath, so we have to do a bit of traversing magic

scriptClasspath += "../conf/application.conf"

etc default file

This is only another way to set the -Dconfig.file parameter to the desired application path.
See the etc default documentatin for more details

@muuki88 muuki88 closed this as completed Jul 1, 2018
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

2 participants