How to escape multiline values in .env file
See original GitHub issueFirst of all, thanks a million for this action, it’s super useful.
I was wondering how to escape multiline env vars. let’s say I have a cert that I want to pass to my .env file from a github secret. This works locally because I can wrap the cert in quotes in my local .env file. How can I accomplish the same thing with this action? I don’t think it does this by default, because right now I’m getting the following error when I try to run docker-compose
Run docker compose -f docker-compose.yml -f production.yml build
unexpected character "+" in variable name near "***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\nPOSTGRES_DB=***\nPOSTGRES_HOST=***\nPOSTGRES_PASSWORD=***\nPOSTGRES_PORT=***\nPOSTGRES_USER=***\nREDIS_HOST=***\nREDIS_PASSWORD=***\nREDIS_PORT=***\n"
Error: Process completed with exit code 1.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to Export a Multi-line Environment Variable in Bash ...
I'm using a .env file with a project in Glitch, and wrapping the key in single quotes was the only solution that worked...
Read more >multiline environment variable in /etc/environment - Super User
Title says it all really. I'm trying to set an RSA private key in /etc/environment.
Read more >Multiline environment variable support : IDEA-185315
1. Create any build configuration, for instance, for Python script. · 2. Go to Environment->Environment variables · 3. Add a variable TEST_VAR and...
Read more >How to create .env multiline variable - docker - Server Fault
Locally I just export MY_ENV_VAR=$(cat my_key.pem) , but on the server, it needs to be inside the .env file and needs to contain...
Read more >Dotenv File Format — Dotenvy v0.7.0 - HexDocs
.env files (a.k.a. "dotenv") store key-value pairs in a format descended from ... The following character strings will be interpreted (i.e. escaped) as ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m specifically thinking of an RSA key or some similar value where the line breaks are meaningful and have to be encoded in some way.
In my instance, I was using dotenv in a Node.js project which supports wrapping multiline variables in quotes like this.
I guess in this situation,
create-envfile
needs to know if you’re intentionally passing in a variable that has linebreaks or if you’re not and it should through an error.This seems a little hacky, but may be just adding something to the prefix like:
Yea @AngelOnFira that would be awesome.