mirror of
https://github.com/zokradonh/kopano-docker.git
synced 2026-08-11 16:32:59 +00:00
implement new env variable to disable all automatic actions (#434)
* implement new env variable to disable all automatic actions fixes https://github.com/zokradonh/kopano-docker/issues/360 * wrap the remaining services in checks if autoconfigure/disable_checks is used * move definition of AUTOCONFIGURE variable into base image * add logic to kapps and kdav container * add autoconfigure to konnect container * update build stage to latest golang * add autoconfig to remaining images * delete obsolete apache config in z-push folder * when specifying config paths use KOPANO_CONFIG_PATH * also use env variable in helper scripts * add message about removal of kopano-cli
This commit is contained in:
+58
-53
@@ -1,16 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
ADDITIONAL_KOPANO_PACKAGES=${ADDITIONAL_KOPANO_PACKAGES:-""}
|
||||
AUTOCONFIGURE=${AUTOCONFIGURE:-true} # when set to false will disable all automatic configuration actions
|
||||
|
||||
set -eu # unset variables are errors & non-zero return values exit the whole script
|
||||
[ "$DEBUG" ] && set -x
|
||||
|
||||
# copy configuration files to /tmp/kopano to prevent modification of mounted config files
|
||||
mkdir -p /tmp/kopano
|
||||
cp /etc/kopano/*.cfg /tmp/kopano
|
||||
if [ "${AUTOCONFIGURE}" == true ]; then
|
||||
# copy configuration files to /tmp/kopano to prevent modification of mounted config files
|
||||
mkdir -p /tmp/kopano
|
||||
cp /etc/kopano/*.cfg /tmp/kopano
|
||||
|
||||
echo "Applying cfg changes from env"
|
||||
/usr/bin/python3 /kopano/cfg-from-env.py
|
||||
echo "Applying cfg changes from env"
|
||||
/usr/bin/python3 /kopano/cfg-from-env.py
|
||||
fi
|
||||
|
||||
meetversion=$(dpkg-query --showformat='${Version}' --show kopano-calendar-webapp)
|
||||
echo "Using Kopano Calendar: $meetversion"
|
||||
@@ -21,58 +24,60 @@ if [ $# -gt 0 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
cp /usr/share/doc/kopano-calendar-webapp/config.json.in /tmp/calendar.json
|
||||
CONFIG_JSON="/tmp/calendar.json"
|
||||
# TODO move into extra file to make it easier to reuse
|
||||
echo "Updating $CONFIG_JSON"
|
||||
for setting in $(compgen -A variable KCCONF_CALENDAR); do
|
||||
setting2=${setting#KCCONF_CALENDAR_}
|
||||
# dots in setting2 need to be escaped to not be handled as separate entities in the json file
|
||||
case ${!setting} in
|
||||
true|TRUE|false|FALSE|[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
|
||||
jq ".\"${setting2//_/\".\"}\" = ${!setting}" $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
;;
|
||||
*)
|
||||
jq ".\"${setting2//_/\".\"}\" = \"${!setting}\"" $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ "${AUTOCONFIGURE}" == true ]; then
|
||||
cp /usr/share/doc/kopano-calendar-webapp/config.json.in /tmp/calendar.json
|
||||
CONFIG_JSON="/tmp/calendar.json"
|
||||
# TODO move into extra file to make it easier to reuse
|
||||
echo "Updating $CONFIG_JSON"
|
||||
for setting in $(compgen -A variable KCCONF_CALENDAR); do
|
||||
setting2=${setting#KCCONF_CALENDAR_}
|
||||
# dots in setting2 need to be escaped to not be handled as separate entities in the json file
|
||||
case ${!setting} in
|
||||
true|TRUE|false|FALSE|[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
|
||||
jq ".\"${setting2//_/\".\"}\" = ${!setting}" $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
;;
|
||||
*)
|
||||
jq ".\"${setting2//_/\".\"}\" = \"${!setting}\"" $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Populate app grid
|
||||
# TODO move into extra file to make it easier to reuse
|
||||
# Note: if all of below variables are set to "no" kpop will fall back to its default behaviour and show all known apps.
|
||||
# Populate app grid
|
||||
# TODO move into extra file to make it easier to reuse
|
||||
# Note: if all of below variables are set to "no" kpop will fall back to its default behaviour and show all known apps.
|
||||
|
||||
# enable Kopano Konnect in the app grid
|
||||
if [ "${GRID_KONNECT:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-konnect"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
# enable Kopano Konnect in the app grid
|
||||
if [ "${GRID_KONNECT:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-konnect"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
fi
|
||||
|
||||
# enable Kopano Meet in the app grid
|
||||
if [ "${GRID_MEET:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-meet"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
fi
|
||||
|
||||
# enable Kopano WebApp in the app grid
|
||||
if [ "${GRID_WEBAPP:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-webapp"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
fi
|
||||
|
||||
# enable Kopano WebApp in the app grid
|
||||
if [ "${GRID_CALENDAR:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-calendar"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
fi
|
||||
|
||||
sed s/\ *=\ */=/g /tmp/kopano/kwebd.cfg > /tmp/kweb-env
|
||||
# always disable tls
|
||||
export tls=no
|
||||
# shellcheck disable=SC2046
|
||||
export $(grep -v '^#' /tmp/kweb-env | xargs -d '\n')
|
||||
|
||||
# services need to be aware of the machine-id
|
||||
dockerize \
|
||||
-wait file:///etc/machine-id \
|
||||
-wait file:///var/lib/dbus/machine-id
|
||||
fi
|
||||
|
||||
# enable Kopano Meet in the app grid
|
||||
if [ "${GRID_MEET:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-meet"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
fi
|
||||
|
||||
# enable Kopano WebApp in the app grid
|
||||
if [ "${GRID_WEBAPP:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-webapp"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
fi
|
||||
|
||||
# enable Kopano WebApp in the app grid
|
||||
if [ "${GRID_CALENDAR:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-calendar"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
fi
|
||||
|
||||
sed s/\ *=\ */=/g /tmp/kopano/kwebd.cfg > /tmp/kweb-env
|
||||
# always disable tls
|
||||
export tls=no
|
||||
# shellcheck disable=SC2046
|
||||
export $(grep -v '^#' /tmp/kweb-env | xargs -d '\n')
|
||||
|
||||
# services need to be aware of the machine-id
|
||||
dockerize \
|
||||
-wait file:///etc/machine-id \
|
||||
-wait file:///var/lib/dbus/machine-id
|
||||
|
||||
# cleaning up env variables
|
||||
unset "${!KCCONF_@}"
|
||||
exec kopano-kwebd serve
|
||||
|
||||
Reference in New Issue
Block a user