diff options
author | Ondrej Kubik <ondrej.kubik@canonical.com> | 2017-11-04 19:20:37 +0000 |
---|---|---|
committer | Ondrej Kubik <ondrej.kubik@canonical.com> | 2018-02-21 22:29:23 +0000 |
commit | 3665a9131c4f0bac07727a5f908905e9a6348535 (patch) | |
tree | df9827d96dc0f36d9c7243b4c03e19cc324ed7f3 /snap-src/bin/wekan-read-settings | |
parent | f7fe44fcdf56ef5a761924865c6d5869539b6410 (diff) | |
download | wekan-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-x | snap-src/bin/wekan-read-settings | 38 |
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 |