Skip to content

Commit

Permalink
removes duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Carvalho committed Sep 20, 2024
1 parent ff48ca1 commit 33e79bd
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,10 @@ set_config_var() {
local config_varname="$2"
local service_name="$3"
local env_varval="${!env_varname}"
local config_fpath="/etc/cyral/cyral-${service_name}/config.yaml"
# If var is empty don't touch the config
[ -z "$env_varval" ] && return

if grep -q "^${config_varname}:" <"$config_fpath"; then
# Variable already exists in config file, just override
sed -i "s/^${config_varname}:.*/${config_varname}: ${env_varval}/g" \
"$config_fpath"
else
# Variable does not exist, append it to config file
printf "%s: %s\n" "${config_varname}" "${env_varval}" >>"$config_fpath"
fi
set_config "$config_varname" "$env_varval" "$service_name"
}

set_advanced_config() {
Expand Down

0 comments on commit 33e79bd

Please sign in to comment.