summaryrefslogtreecommitdiffstats
path: root/snap-src/bin/wekan-read-settings
diff options
context:
space:
mode:
authorOndrej Kubik <ondrej.kubik@canonical.com>2017-11-04 19:20:37 +0000
committerOndrej Kubik <ondrej.kubik@canonical.com>2018-02-21 22:29:23 +0000
commit3665a9131c4f0bac07727a5f908905e9a6348535 (patch)
treedf9827d96dc0f36d9c7243b4c03e19cc324ed7f3 /snap-src/bin/wekan-read-settings
parentf7fe44fcdf56ef5a761924865c6d5869539b6410 (diff)
downloadwekan-3665a9131c4f0bac07727a5f908905e9a6348535.tar.gz
wekan-3665a9131c4f0bac07727a5f908905e9a6348535.tar.bz2
wekan-3665a9131c4f0bac07727a5f908905e9a6348535.zip
splitting hooks and using snapctl instead of local settings file
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
Diffstat (limited to 'snap-src/bin/wekan-read-settings')
-rwxr-xr-xsnap-src/bin/wekan-read-settings38
1 files changed, 11 insertions, 27 deletions
diff --git a/snap-src/bin/wekan-read-settings b/snap-src/bin/wekan-read-settings
index aec05bba..a924eaea 100755
--- a/snap-src/bin/wekan-read-settings
+++ b/snap-src/bin/wekan-read-settings
@@ -3,34 +3,18 @@
# 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
+ 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