From c6892d7289374577cc28054cd2b853b485f6f3eb Mon Sep 17 00:00:00 2001 From: Toby Date: Sun, 29 Apr 2018 21:19:36 +0100 Subject: [PATCH] #57 https://stackoverflow.com/questions/49944085/configure-dynamic-command-line-arguments-in-sbt-native-packager add in java.rmi.server.hostname --- package.sbt | 4 +++- src/universal/conf/application.ini | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.sbt b/package.sbt index 047e134..36cfb41 100644 --- a/package.sbt +++ b/package.sbt @@ -53,4 +53,6 @@ mappings in Universal ++= (proguard in Proguard).value.map(jar => jar -> ("lib/" // point the classpath to the output from the proguard task scriptClasspath := (proguard in Proguard).value.map(jar => jar.getName) -bashScriptExtraDefines ++= IO.readLines(sourceDirectory.value / "universal" / "conf" / "find_ip.sh") \ No newline at end of file +bashScriptExtraDefines ++= IO.readLines(sourceDirectory.value / "universal" / "conf" / "find_ip.sh") + +bashScriptExtraDefines += """addJava "-Djava.rmi.server.hostname=$(getIpAddress)"""" \ No newline at end of file diff --git a/src/universal/conf/application.ini b/src/universal/conf/application.ini index b670f5b..63e9fff 100644 --- a/src/universal/conf/application.ini +++ b/src/universal/conf/application.ini @@ -4,8 +4,9 @@ # # cat application.ini | grep sed '/^\#/d;s/\r$//' # -# To get the externally facing IP address, we use a function defined -# in another file which is pulled into the main script +# To get the externally facing IP address (java.rmi.server.hostname), +# we use a function defined in another file which is expanding via +# bashScriptExtraDefines (see https://bit.ly/2raOEN4) -J-Xms256m -J-Xmx512m @@ -13,5 +14,4 @@ -Dcom.sun.management.jmxremote.port=1616 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false --Djava.rmi.server.hostname="$(getIpAddress)" -Dconfig.file=/home/pi/.temperature/temperature-machine.cfg