Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dotenv multiline variables

I'm using dotenv.

A Ruby gem to load environment variables from .env.

Is it possible to have multiline variables in my .env file?

e.g.

SOMETHING_CERTIFICATE="-----BEGIN CERTIFICATE----- JSDFALDAFSSKLABVCXZLV2314IH4IHDFG9AYDF9DSSDF82QWEIWFHDSSD8SADF0= -----END CERTIFICATE-----" 

^ having the above just throws an error on that middle line, as if it's not part of the string and I'm trying to create an improperly formatted variable.

like image 744
Mirror318 Avatar asked Sep 11 '17 01:09

Mirror318


1 Answers

Did you try reading the documentation?

Multi-line values

If you need multiline variables, for example private keys, you can double quote strings and use the \n character for newlines:

PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nHkVN9…\n-----END DSA PRIVATE KEY-----\n"

like image 89
Brian Avatar answered Sep 28 '22 06:09

Brian