summaryrefslogtreecommitdiffstats
path: root/snap-src/bin/wekan-read-settings
diff options
context:
space:
mode:
Diffstat (limited to 'snap-src/bin/wekan-read-settings')
-rwxr-xr-xsnap-src/bin/wekan-read-settings29
1 files changed, 29 insertions, 0 deletions
diff --git a/snap-src/bin/wekan-read-settings b/snap-src/bin/wekan-read-settings
new file mode 100755
index 00000000..f216c2a8
--- /dev/null
+++ b/snap-src/bin/wekan-read-settings
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# read wekan config
+source $SNAP/bin/config
+
+
+for key in ${keys[@]}
+do
+ default_value="DEFAULT_$key"
+ description="DESCRIPTION_$key"
+ snappy_key="KEY_$key"
+ value=$(snapctl get ${!snappy_key})
+ if [ "x$value" == "x" ]; then
+ echo -e "$key=${!default_value} (default value)"
+ export $key=${!default_value}
+ else
+ echo -e "$key=$value"
+ export $key=$value
+ fi
+done
+
+# if caddy is enabled, do update port settings based on caddy file
+if [ "$CADDY_ENABLED" = "true" ]; then
+ echo "caddy is enabled, adjusting ports"
+ export CADDY_PORT=${PORT}
+ echo -e "CADDY_PORT=$CADDY_PORT"
+ export PORT=${CADDY_BIND_PORT}
+ echo -e "PORT=$PORT"
+fi