Skip to content

Commit

Permalink
Merge pull request #63 from linode/fix-manifest-gen-macos
Browse files Browse the repository at this point in the history
Avoid new lines when base64 encoding values
  • Loading branch information
phillc authored Mar 12, 2020
2 parents 7237f7d + 25a2a8f commit a294305
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions deploy/generate-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ Second argument must be a Linode region.
Example:
$ ./generate-manifest.sh \$LINODE_API_TOKEN us-east"

ENCODED_TOKEN=$(echo -n $1 | base64)
ENCODED_REGION=$(echo -n $2 | base64)
BASE64FLAGS=""
longstring="1234567890123456789012345678901234567890123456789012345678901234567890"
if [ $(echo "$longstring" | base64 | wc -l) -gt 1 ]; then
BASE64FLAGS="-w0"
fi

echo $BASE64FLAGS

ENCODED_TOKEN=$(echo -n $1 | base64 $BASE64FLAGS)
ENCODED_REGION=$(echo -n $2 | base64 $BASE64FLAGS)

cat "$(dirname "$0")/ccm-linode-template.yaml" |
sed -e "s|{{ .Values.apiTokenB64 }}|$ENCODED_TOKEN|" |
Expand Down

0 comments on commit a294305

Please sign in to comment.