Fix quoting typo
This commit is contained in:
parent
8a21f497e7
commit
0a2f308ec4
|
@ -317,47 +317,47 @@ function display_startup_daemon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function override_config() {
|
function override_config() {
|
||||||
notify "task" "Starting do do overrides"
|
notify "task" "Starting do do overrides"
|
||||||
|
|
||||||
declare -A config_overrides
|
declare -A config_overrides
|
||||||
|
|
||||||
_env_variable_prefix=$1
|
_env_variable_prefix=$1
|
||||||
[ -z ${_env_variable_prefix} ] && return 1
|
[ -z ${_env_variable_prefix} ] && return 1
|
||||||
|
|
||||||
|
|
||||||
IFS=" " read -r -a _config_files <<< $2
|
IFS=" " read -r -a _config_files <<< $2
|
||||||
|
|
||||||
# dispatch env variables
|
# dispatch env variables
|
||||||
for env_variable in $(printenv | grep $_env_variable_prefix);do
|
for env_variable in $(printenv | grep $_env_variable_prefix);do
|
||||||
# get key
|
# get key
|
||||||
# IFS not working because values like ldap_query_filter or search base consists of several '='
|
# IFS not working because values like ldap_query_filter or search base consists of several '='
|
||||||
# IFS="=" read -r -a __values <<< $env_variable
|
# IFS="=" read -r -a __values <<< $env_variable
|
||||||
# key="${__values[0]}"
|
# key="${__values[0]}"
|
||||||
# value="${__values[1]}"
|
# value="${__values[1]}"
|
||||||
key=$(echo $env_variable | cut -d "=" -f1)
|
key=$(echo $env_variable | cut -d "=" -f1)
|
||||||
key=${key#"${_env_variable_prefix}"}
|
key=${key#"${_env_variable_prefix}"}
|
||||||
# make key lowercase
|
# make key lowercase
|
||||||
key=${key,,}
|
key=${key,,}
|
||||||
# get value
|
# get value
|
||||||
value=$(echo $env_variable | cut -d "=" -f2-)
|
value=$(echo $env_variable | cut -d "=" -f2-)
|
||||||
|
|
||||||
config_overrides[$key]=$value
|
config_overrides[$key]=$value
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in "${_config_files[@]}"
|
for f in "${_config_files[@]}"
|
||||||
do
|
do
|
||||||
if [ ! -f "${f}" ];then
|
if [ ! -f "${f}" ];then
|
||||||
echo "Can not find ${f}. Skipping override"
|
echo "Can not find ${f}. Skipping override"
|
||||||
else
|
else
|
||||||
for key in ${!config_overrides[@]}
|
for key in ${!config_overrides[@]}
|
||||||
do
|
do
|
||||||
[ -z $key ] && echo -e "\t no key provided" && return 1
|
[ -z $key ] && echo -e "\t no key provided" && return 1
|
||||||
|
|
||||||
sed -i -e "s|^${key}[[:space:]]\+.*|${key} = ${config_overrides[$key]//&/\\&}|g' \
|
sed -i -e "s|^${key}[[:space:]]\+.*|${key} = ${config_overrides[$key]//&/\\&}|g" \
|
||||||
${f}
|
${f}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
Loading…
Reference in New Issue