diff options
author | Ondrej Kubik <ondrej.kubik@canonical.com> | 2017-11-04 19:23:28 +0000 |
---|---|---|
committer | Ondrej Kubik <ondrej.kubik@canonical.com> | 2018-02-21 22:29:23 +0000 |
commit | e077c85d003fb3cfd837ad8064ade767fa8fe04f (patch) | |
tree | a2440082e3c4f8917095758dead9a577b3efa4b5 /snap/hooks | |
parent | 3665a9131c4f0bac07727a5f908905e9a6348535 (diff) | |
download | wekan-e077c85d003fb3cfd837ad8064ade767fa8fe04f.tar.gz wekan-e077c85d003fb3cfd837ad8064ade767fa8fe04f.tar.bz2 wekan-e077c85d003fb3cfd837ad8064ade767fa8fe04f.zip |
Adding caddy support
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
Diffstat (limited to 'snap/hooks')
-rwxr-xr-x | snap/hooks/configure | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/snap/hooks/configure b/snap/hooks/configure index 60ce81e8..fd18da33 100755 --- a/snap/hooks/configure +++ b/snap/hooks/configure @@ -7,4 +7,16 @@ echo "$(date '+%Y-%m-%d %H:%M:%S') $0: Entering hook" . $SNAP/bin/config # settings were altered by user, safest way to get them applied is to restart service +# first check if caddy service is enabled +value=$(snapctl get caddy-enabled) +if [ "$value" = "true" ]; then + # update caddy file + bind_port=$(snapctl get caddy-bind-port) + port=$(snapctl get port) + [ "x" != "x${bind_port}" ] && sed -i 's|proxy / localhost:.* {|proxy / localhost:'"${bind_port}"' {|g' $SNAP_COMMON/Caddyfile + [ "x" != "x$port" ] && sed -i 's|http://:.*|http://:'"${port}"'|g' $SNAP_COMMON/Caddyfile + snapctl start caddy-service 2>&1 || true +else + snapctl stop caddy-service 2>&1 || true +fi |