I want to use JavaScript's Template Literals in an .env
file.
Specifically, I am trying to store a JWT public key in the .env
file:
PUBLIC_KEY=
`--BEGIN PUBLIC--
AAAAAA
BBBBBB
CCCCCC
--END PUBLIC--`
But when I try to pull it out using process.env.PUBLIC_KEY
JS returns an empty string.
I am using gulp to translate TypeScript but the .env
is in the root directory and is required
at the start of the gulpfile
.
Good news. v16.0.0 and greater now supports JavaScript Template Literals.
You can use it like the following:
PUBLIC_KEY=`--BEGIN PUBLIC--
AAAAAA
BBBBBB
CCCCCC
--END PUBLIC--`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With