mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-08-09 00:24:58 +02:00
Ignore case for boolean vars
This commit is contained in:
@ -5,7 +5,7 @@ set -o pipefail
|
||||
set +e
|
||||
|
||||
# Script trace mode
|
||||
if [ "${DEBUG_MODE}" == "true" ]; then
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
set -o xtrace
|
||||
fi
|
||||
|
||||
@ -17,6 +17,9 @@ fi
|
||||
# Default Zabbix server port number
|
||||
: ${ZBX_SERVER_PORT:="10051"}
|
||||
|
||||
# Default timezone for web interface
|
||||
: ${PHP_TZ:="Europe/Riga"}
|
||||
|
||||
# Default directories
|
||||
# Configuration files directory
|
||||
ZABBIX_ETC_DIR="/etc/zabbix"
|
||||
@ -63,17 +66,17 @@ check_variables() {
|
||||
file_env MYSQL_USER
|
||||
file_env MYSQL_PASSWORD
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD}" == "true" ]; then
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ "${MYSQL_RANDOM_ROOT_PASSWORD,,}" == "true" ]; then
|
||||
echo "**** Impossible to use MySQL server because of unknown Zabbix user and random 'root' password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" != "true" ]; then
|
||||
if [ ! -n "${MYSQL_USER}" ] && [ ! -n "${MYSQL_ROOT_PASSWORD}" ] && [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" != "true" ]; then
|
||||
echo "*** Impossible to use MySQL server because 'root' password is not defined and it is not empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
if [ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || [ -n "${MYSQL_ROOT_PASSWORD}" ]; then
|
||||
USE_DB_ROOT_USER=true
|
||||
DB_SERVER_ROOT_USER="root"
|
||||
DB_SERVER_ROOT_PASS=${MYSQL_ROOT_PASSWORD:-""}
|
||||
@ -83,7 +86,7 @@ check_variables() {
|
||||
|
||||
# If root password is not specified use provided credentials
|
||||
: ${DB_SERVER_ROOT_USER:=${MYSQL_USER}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
[ "${MYSQL_ALLOW_EMPTY_PASSWORD,,}" == "true" ] || DB_SERVER_ROOT_PASS=${DB_SERVER_ROOT_PASS:-${MYSQL_PASSWORD}}
|
||||
DB_SERVER_ZBX_USER=${MYSQL_USER:-"zabbix"}
|
||||
DB_SERVER_ZBX_PASS=${MYSQL_PASSWORD:-"zabbix"}
|
||||
|
||||
@ -117,7 +120,7 @@ check_db_connect() {
|
||||
echo "* DB_SERVER_HOST: ${DB_SERVER_HOST}"
|
||||
echo "* DB_SERVER_PORT: ${DB_SERVER_PORT}"
|
||||
echo "* DB_SERVER_DBNAME: ${DB_SERVER_DBNAME}"
|
||||
if [ "${DEBUG_MODE}" == "true" ]; then
|
||||
if [ "${DEBUG_MODE,,}" == "true" ]; then
|
||||
if [ "${USE_DB_ROOT_USER}" == "true" ]; then
|
||||
echo "* DB_SERVER_ROOT_USER: ${DB_SERVER_ROOT_USER}"
|
||||
echo "* DB_SERVER_ROOT_PASS: ${DB_SERVER_ROOT_PASS}"
|
||||
@ -176,7 +179,8 @@ prepare_zbx_web_config() {
|
||||
echo "listen.group = nginx" >> "$PHP_CONFIG_FILE"
|
||||
fi
|
||||
|
||||
export ZBX_DENY_GUI_ACCESS=${ZBX_DENY_GUI_ACCESS:-"false"}
|
||||
: ${ZBX_DENY_GUI_ACCESS:="false"}
|
||||
export ZBX_DENY_GUI_ACCESS=${ZBX_DENY_GUI_ACCESS,,}
|
||||
export ZBX_GUI_ACCESS_IP_RANGE=${ZBX_GUI_ACCESS_IP_RANGE:-"['127.0.0.1']"}
|
||||
export ZBX_GUI_WARNING_MSG=${ZBX_GUI_WARNING_MSG:-"Zabbix is under maintenance."}
|
||||
|
||||
@ -198,17 +202,20 @@ prepare_zbx_web_config() {
|
||||
export ZBX_SERVER_PORT=${ZBX_SERVER_PORT:-"10051"}
|
||||
export ZBX_SERVER_NAME=${ZBX_SERVER_NAME}
|
||||
|
||||
export ZBX_DB_ENCRYPTION=${ZBX_DB_ENCRYPTION:-"false"}
|
||||
: ${ZBX_DB_ENCRYPTION:="false"}
|
||||
export ZBX_DB_ENCRYPTION=${ZBX_DB_ENCRYPTION,,}
|
||||
export ZBX_DB_KEY_FILE=${ZBX_DB_KEY_FILE}
|
||||
export ZBX_DB_CERT_FILE=${ZBX_DB_CERT_FILE}
|
||||
export ZBX_DB_CA_FILE=${ZBX_DB_CA_FILE}
|
||||
export ZBX_DB_VERIFY_HOST=${ZBX_DB_VERIFY_HOST-"false"}
|
||||
: ${ZBX_DB_VERIFY_HOST="false"}
|
||||
export ZBX_DB_VERIFY_HOST=${ZBX_DB_VERIFY_HOST,,}
|
||||
|
||||
export ZBX_VAULTURL=${ZBX_VAULTURL}
|
||||
export ZBX_VAULTDBPATH=${ZBX_VAULTDBPATH}
|
||||
export VAULT_TOKEN=${VAULT_TOKEN}
|
||||
|
||||
export DB_DOUBLE_IEEE754=${DB_DOUBLE_IEEE754:-"true"}
|
||||
: ${DB_DOUBLE_IEEE754:="true"}
|
||||
export DB_DOUBLE_IEEE754=${DB_DOUBLE_IEEE754,,}
|
||||
|
||||
export ZBX_HISTORYSTORAGEURL=${ZBX_HISTORYSTORAGEURL}
|
||||
export ZBX_HISTORYSTORAGETYPES=${ZBX_HISTORYSTORAGETYPES:-"[]"}
|
||||
@ -221,7 +228,9 @@ prepare_zbx_web_config() {
|
||||
rm -f "/tmp/defines.inc.php_tmp"
|
||||
fi
|
||||
|
||||
if [ "${ENABLE_WEB_ACCESS_LOG:-"true"}" == "false" ]; then
|
||||
: ${ENABLE_WEB_ACCESS_LOG:="true"}
|
||||
|
||||
if [ "${ENABLE_WEB_ACCESS_LOG,,}" == "false" ]; then
|
||||
sed -ri \
|
||||
-e 's!^(\s*CustomLog)\s+\S+!\1 /dev/null!g' \
|
||||
"/etc/httpd/conf/httpd.conf"
|
||||
|
Reference in New Issue
Block a user