HathorNetwork / hathor-wallet-service-old

MIT License
4 stars 4 forks source link

fix: codebuild was failing when trying to set an env var with newlines #353

Closed luislhl closed 1 year ago

luislhl commented 1 year ago

Acceptance Criteria

Codebuild was failing when trying to set an env var with newlines.

This is a script that demonstrates the problem:

set -e;

export dev_TEST="VALUE WITH     TABS\nAND NEWLINE"

for var in "${!dev_@}"; do
  export ${var#dev_}=${!var}
done

echo $TEST

Running it yelds the error:

test.sh: line 6: export: `TABS\nAND': not a valid identifier

The fix is to make sure we use quotes when assigning the value of the new env var in line 6:

set -e;

export dev_TEST="VALUE WITH     TABS\nAND NEWLINE"

for var in "${!dev_@}"; do
  export ${var#dev_}="${!var}"
done

echo $TEST

Security Checklist