Skip to main content

Using Multiple Line(newline) Environment Variables in CircleCI

base64 for Multi-line Environment Variables

In order to save an environment variable with newlines, the variable can be base64 encoded before saving and then unencoded during the CircleCI build.

cat example.txt | base64 -w 0

That value can then be copied and pasted into the CircleCI dashboard and used during a CircleCI build:

MY_UNENCODED_VALUE=$(echo $MY_ENCODED_VALUE | base64 -d)
Did this answer your question?