Set working dir and server URL for Motech, related to #166

This commit is contained in:
Disassembler 2017-12-08 22:20:23 +01:00
parent f5214cf64e
commit f4e76c340a
3 changed files with 8 additions and 1 deletions

View File

@ -4,9 +4,11 @@ After=network.target
[Service] [Service]
Type=forking Type=forking
User=motech
WorkingDirectory=/srv/motech
ExecStartPre=/srv/motech/update-ip.sh
ExecStart=/srv/motech/bin/startup.sh ExecStart=/srv/motech/bin/startup.sh
ExecStop=/srv/motech/bin/shutdown.sh ExecStop=/srv/motech/bin/shutdown.sh
User=motech
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -1,2 +1,3 @@
system.language=en system.language=en
login.mode=repository login.mode=repository
server.url=http://127.0.0.1

4
motech/srv/motech/update-ip.sh Executable file
View File

@ -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