Creating an environment variable like SECRET_KEY with value “super secret contents 123abc” works great of course. But if I have a lot of these, it’s more convenient to paste them in to a Secret File. If I do that with a file called .env in a Node app, does that mean that every line in that file like SECRET_KEY="super secret contents 123abc" is automagically created as an environment variable?
That was my assumption but now I’m debugging things and wanted to make sure that was true and I’m not seeing any clarification in the documentation.
Creating a secret file on Render is the same as creating one on a local machine and is available to read at the root of your repo (or Docker context). They are also available to load by absolute path at /etc/secrets/<filename>. We don’t do any special processing of your secret files so when you create a .env file for example, with Node, you would need to use a package like dotenv to source the variables from that file. I hope that helps!
Oh ho, that was my problem. I’m too much of a Node noob. I thought that happened automatically. The dotenv package sounds like the way to go! Thanks so much!