Accessing host ip as environment var for production.conf at systemd unite of playframework debian #11438
-
I have a playframework application what I run as debian file generated by sbt-native-packager. In the production.conf file I need to access But at systemd (when I run sudo systemctl start app.service) app can't access Is there any way (in build.sbt or other) that I can pass environment variable to my debian app production.conf which is run by systemctl ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
First, I in production, there is no build.sbt anymore. You are using sbt-native-packer, so the question is which kind of package do you generate? It's very likely Play will get started through a bash script, probably this one here: https://github.com/sbt/sbt-native-packager/blob/d2fd665a5b3dcd2e4f4b15964a98268bfe4b8235/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bash-template#L321-L325 |
Beta Was this translation helpful? Give feedback.
First, I in production, there is no build.sbt anymore. You are using sbt-native-packer, so the question is which kind of package do you generate? It's very likely Play will get started through a bash script, probably this one here: https://github.com/sbt/sbt-native-packager/blob/d2fd665a5b3dcd2e4f4b15964a98268bfe4b8235/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bash-template#L321-L325
As you can see from the lines I referenced you can pass system variables via
-Dkey=val
arguments, or also use setJAVA_OPTS
.Maybe also have a look in the sbt-native-packer file , I think there might be options you can set to set up the service file so it passes on the variables to your …