From f4e76c340a5a1c976135d4950fc75c58d19deb61 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Fri, 8 Dec 2017 22:20:23 +0100 Subject: [PATCH] Set working dir and server URL for Motech, related to #166 --- motech/lib/systemd/system/motech.service | 4 +++- motech/srv/motech/.motech/config/motech-settings.properties | 1 + motech/srv/motech/update-ip.sh | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100755 motech/srv/motech/update-ip.sh diff --git a/motech/lib/systemd/system/motech.service b/motech/lib/systemd/system/motech.service index d5bf666..f62de67 100644 --- a/motech/lib/systemd/system/motech.service +++ b/motech/lib/systemd/system/motech.service @@ -4,9 +4,11 @@ After=network.target [Service] Type=forking +User=motech +WorkingDirectory=/srv/motech +ExecStartPre=/srv/motech/update-ip.sh ExecStart=/srv/motech/bin/startup.sh ExecStop=/srv/motech/bin/shutdown.sh -User=motech [Install] WantedBy=multi-user.target diff --git a/motech/srv/motech/.motech/config/motech-settings.properties b/motech/srv/motech/.motech/config/motech-settings.properties index 61167ad..838d8dd 100644 --- a/motech/srv/motech/.motech/config/motech-settings.properties +++ b/motech/srv/motech/.motech/config/motech-settings.properties @@ -1,2 +1,3 @@ system.language=en login.mode=repository +server.url=http://127.0.0.1 diff --git a/motech/srv/motech/update-ip.sh b/motech/srv/motech/update-ip.sh new file mode 100755 index 0000000..c0a2399 --- /dev/null +++ b/motech/srv/motech/update-ip.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +URL=$(ip route get 1 | awk '{print $NF;exit}') +sed -i "s|^server\.url.*|server.url=https://${URL}/motech|" /srv/motech/.motech/config/motech-settings.properties