xavdid / heroku-config

[Utility] Push and pull heroku environment variables to your local env

Home Page:https://www.npmjs.com/package/heroku-config

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multiline environment variables

urkle opened this issue · comments

Currently I can export out a multiline environment variable with config:push and it shows up in the .env file as

MY_SECRET_KEY="-----BEGIN RSA PRIVATE KEY-----
MIIrandomtext
morerandomtext
-----END RSA PRIVATE KEY-----"

However importing that does not work it only imports the first line and throws warning while parsing the rest.

Currently I can only set them directly using the config:set like this.

heroku config:set MY_SECRET_KEY="$(cat mysecretkey.pem)" -a my-heroku-app

Ah that's a good point.

Honestly I've been toying with switching to dotenv for parsing instead of reinventing the wheel. They handle multiline, but I'm not sure they're fully compatible with what I've written so far.

My biggest concern is how the heroku plugsins auto-update (that is, if I cut a SemVer.major release, does it auto update and break installs?) and i've written in for clarification.

For this issue specifically, I'll test dotenv today and if it doesn't work, I can write multiline myself and let you know.

@urkle, ok, updated the package (and cut a release) to parse multilines if enclosed in ". See README for more details. Thanks for the report!

still not working for heroku local env.

@ktmatzdorf that's a bummer, it's working fine on my end. Are you on the latest version (v1.4.0; you can check with heroku plugins)?

Note that for multi-line to work, you need to have the data wrapped in ".

If that's the case, can you send me a copy (with fake data) of the .env file you're working with and what OS you're using?

sorry, it seems not plugin related. so wrong place

related..local/share/heroku/client/node_modules/@heroku/foreman/lib/envs.js:44
      case '"': return /^"([^"]*)"/.exec(val)[1];
                                             ^

TypeError: Cannot read property '1' of null

heroku-cli/6.14.20-737bba7 (darwin-x64) node-v8.4.0 on OS X 10.10.5 (14F2315)

Ah yep. When you use heroku local, it uses a program called foreman to parse the local env. That's where this issue is coming from. I'd reach out to foreman themselves