emissary-firmware/misc/emissary/uci-defaults/99-emissary.sh

36 lines
869 B
Bash

#/bin/sh
set -e
main() {
local default_config="/data/emissary/default.conf"
if [ ! -f "${default_config}" ]; then
exit 0
fi
source "${default_config}"
if [ ! -z "${EMISSARY_RECONCILIATION_INTERVAL}" ]; then
uci set "emissary.agent.reconciliation_interval=${EMISSARY_RECONCILIATION_INTERVAL}"
fi
if [ ! -z "${EMISSARY_SERVER_URL}" ]; then
uci set "emissary.agent.server_url=${EMISSARY_SERVER_URL}"
fi
if [ ! -z "${EMISSARY_SENTRY_DSN}" ]; then
uci set "emissary.agent.sentry_dsn=${EMISSARY_SENTRY_DSN}"
fi
if [ ! -z "${EMISSARY_SENTRY_ENVIRONMENT}" ]; then
uci set "emissary.agent.sentry_environment=${EMISSARY_SENTRY_ENVIRONMENT}"
fi
# Commit modifications
uci commit
# Delete file
rm -f "${default_config}"
/etc/init.d/emissary-agent enable
}
main