Mercurial > hg > thermostat-ng
changeset 17:85d12e67675d
Determine gateway base url based on config.
Reviewed-by: jkang
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-September/024799.html
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Thu, 31 Aug 2017 15:20:47 +0200 |
parents | c2b62c4b9110 |
children | 5100a9b678f4 |
files | thermostat-ng.sh |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/thermostat-ng.sh Mon Aug 28 16:13:53 2017 +0200 +++ b/thermostat-ng.sh Thu Aug 31 15:20:47 2017 +0200 @@ -258,6 +258,21 @@ done } +# Gets the base gateway url, based on config: +# WITH_TLS=true => https +# WITH_TLS=false => http +get_gateway_url() { + local gateway_global_config="$WEB_GATEWAY_ROOT/distribution/target/image/etc/global-config.properties" + local with_tls="$(grep ^WITH_TLS $gateway_global_config | cut -d'=' -f2)" + local ip="$(grep ^IP $gateway_global_config | cut -d'=' -f2)" + local port="$(grep ^PORT $gateway_global_config | cut -d'=' -f2)" + local http_prefix="http" + if [ "${with_tls}_" == "true_" ]; then + http_prefix="${http_prefix}s" + fi + echo "${http_prefix}://${ip}:${port}" +} + # set global variable for Cygwin testing # between all shell files, we pass cygwin-compatible paths, # and let each script decide when to convert them. @@ -275,7 +290,7 @@ WEB_GATEWAY_ROOT="${TOP_DIR}/web-gateway" AGENT_ROOT="${TOP_DIR}/agent" WEB_CLIENT_ROOT="${TOP_DIR}/web-client" -GATEWAY_URL="https://127.0.0.1:30000" +GATEWAY_URL="$(get_gateway_url)" DO_BUILD=${BUILD:-true} RUN_DATA_DIR="$TOP_DIR/data"