You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the value of a secret contains several words with a blank space or a hyphen between them, some of those words are printed in the log at the beginning and also the value might change if it includes a hyphen, because it changes to an underscore.
VARIABLE1 is stored in the parameter store (its value includes a hyphen): chamber write <service_name> VARIABLE1 'VALUE1 VALUE2-VALUE3'
When init.sh is executed (e.g. /init.sh env), it retrieves:
VARIABLE1='VALUE1
VALUE2_VALUE3'
instead of:
VARIABLE1='VALUE1 VALUE2-VALUE3'
Posible solutions
Add double quotes when invoking a variable containing multiple words.
For the case of the hyphen changing to underscore: replace line 94 in init.sh
from:
to_secrets=$(echo $chamber_env | sed 's/export //g' | for e in $(cat -) ; do echo $e | awk '{ gsub("-", "_", $1) } 1' FS='=' OFS='='; done)
to:
to_secrets=$(echo "$chamber_env" | sed 's/export //g' | for e in "$(cat -)" ; do echo "$e" | awk '{ gsub("-", "_", $1) } 1' FS='=' OFS='='; done)
For the values being printed in the log:
Change line 95 from: eval_export $to_secrets to eval_export "$to_secrets"
And change function eval_export (line 66) from:
eval_export() {
to_export="$@"
keys=$(for v in $to_export ; do echo $v | awk -F '=' '{print $1}' ; done)
echo $keys
eval export $to_export
}
to:
eval_export() {
to_export="$@"
keys=$(for v in "$to_export" ; do echo "$v" | awk -F '=' '{print $1}' ; done)
echo $keys
eval export $to_export
}
The text was updated successfully, but these errors were encountered:
Description
When the value of a secret contains several words with a blank space or a hyphen between them, some of those words are printed in the log at the beginning and also the value might change if it includes a hyphen, because it changes to an underscore.
Files
init.sh
To Reproduce
chamber write <service_name> VARIABLE1 'VALUE1 VALUE2-VALUE3'
/init.sh env
), it retrieves:instead of:
Posible solutions
Add double quotes when invoking a variable containing multiple words.
from:
to:
Change line 95 from:
eval_export $to_secrets
toeval_export "$to_secrets"
And change function eval_export (line 66) from:
to:
The text was updated successfully, but these errors were encountered: