{
"$type": "site.standard.document",
"canonicalUrl": "https://johnnyreilly.com/posts/multiline-strings-dot-env-files",
"description": "Learn how to use multiline strings in .env files.",
"path": "/posts/multiline-strings-dot-env-files",
"publishedAt": "2024-03-09T00:00:00.000Z",
"site": "at://did:plc:yy3apqjlms24kso7ahn7lbmb/site.standard.publication/3mova7c4nho2b",
"tags": [
"node.js"
],
"textContent": "I love using .env files to configure my applications. They're a great way to keep configuration in one place and to keep it out of the codebase. They're also a great way to keep secrets out of the codebase.\n\nBut what if you need to use a multiline string in a .env file? How do you do that? You just do it:\n\nThat's right, you just use a newline character. It's that simple. Oddly, searching for that on the internet didn't yield the answer I was looking for. So I'm writing it down here for posterity.\n\nWith your .env file in place, you can then consume it in your application using a package like dotenv. Or if you'd like to use a bash script to consume the .env file, you can do it like this:",
"title": "Multiline strings in .env files"
}