Skip to content

Commit e5d813d

Browse files
committed
Prefix export for parameters.bash v0.0.3
1 parent 7228b8b commit e5d813d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

scripts/parameters.bash

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Collect secrets from AWS SSM Parameter Store and
44
# opt out as environment variable exports.
55

6-
VERSION='0.0.2'
6+
VERSION='0.0.3'
77

88
# Colors
99
C_RESET='\033[0m'
@@ -25,19 +25,22 @@ and output as environment variable exports"
2525
echo
2626
echo "Optional arguments:"
2727
echo " -h Show this help message and exit"
28+
echo " -e Add 'export' prefix before each environment variable"
2829
echo " -n Provide true if server is Blockchain node"
2930
echo " -o Output file name environment variables export to"
3031
echo " -p Product tag (moonstream, spire, brood, drones)"
3132
}
3233

3334
# TODO(kompotkot): Flag for export prefix
35+
export_flag=""
3436
node_flag=""
3537
output_flag=""
3638
product_flag=""
3739
verbose_flag="false"
3840

39-
while getopts 'no:p:v' flag; do
41+
while getopts 'eno:p:v' flag; do
4042
case "${flag}" in
43+
e) export_flag="export " ;;
4144
n) node_flag="true" ;;
4245
o) output_flag="${OPTARG}" ;;
4346
p) product_flag="${OPTARG}" ;;
@@ -91,8 +94,8 @@ for i in $(seq 0 $((${ENV_PARAMETERS_VALUES_LENGTH} - 1))); do
9194
param_key=$(echo ${ENV_PARAMETERS_VALUES} | jq -r .[$i].Name)
9295
param_value=$(echo ${ENV_PARAMETERS_VALUES} | jq .[$i].Value)
9396
if [ -z "${output_flag}" ]; then
94-
echo "${param_key}=${param_value}"
97+
echo "${export_flag}${param_key}=${param_value}"
9598
else
96-
echo "${param_key}=${param_value}" >> "${output_flag}"
99+
echo "${export_flag}${param_key}=${param_value}" >> "${output_flag}"
97100
fi
98101
done

0 commit comments

Comments
 (0)