summaryrefslogtreecommitdiffstats
path: root/snap-src/wekan-read-settings
blob: aec05bba256086085fde04d54ec6c0649dc1b5a2 (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
30
31
32
33
34
35
36
#!/bin/sh

# read wekan config
source $SNAP/bin/config

# TODO: uncomment following, once snapctl can be called from outside the hooks
# for key in ${keys[@]}
# do
#   # snappy is picky about key syntax, using mapping
#   MAP_KEY="KEY_$key"
#   SNAPPY_KEY=
#   if value=$(snapctl get ${!MAP_KEY}); then
#       echo "$key='$value'"
#       export $key=$value
#   else
#       # use default value
#       default_value="DEFAULT_$key"
#       echo "using default value: $key='${!default_value}'"
#       export $key=${!default_value}
#   fi
# done

# TODO: get rid of this workaround once above can be used
# loop through all values, and if not defined, use default value
for key in ${keys[@]}
do
  if [ "x" ==  "x${!key}" ]; then
      # use default value
      default_value="DEFAULT_$key"
      echo "using default value: $key='${!default_value}'"
      export $key=${!default_value}
      # echo "export $key='${!def_value}'" >> $SETTINGS_FILE
  else
      echo "$key='${!key}'"
  fi
done