summaryrefslogtreecommitdiffstats
path: root/snap-src/bin/wekan-read-settings
blob: 236667e96cf4f28ca3ed5fd4125db3831965cca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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