Secrets in secret file .env automatically makes environment variables?

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.

Hi Daniel,

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!

1 Like

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!

Hi!
(Python)

i’m already have a .env.

When i use " add secret file" it have two slots:

“Filename” and “File contents”

Filename: .env
File Contents: BIOLOGY_APIS = ‘{
“richness”: “${RICHNESS_API_URL}”,
“abundance”: “${ABUNDANCE_API_URL}”,
“accumulation_curve”: “${SPECIES_ACCUM_API_URL}”,
“alpha_diversity”: “${ALPHA_DIVERSITY_API_URL}”,
“beta_diversity”: “${BETA_DIVERSITY_API_URL}”,
“redlist”: “${REDLIST_API_URL}”,
“df_manager”: “${DF_MANAGER_API_URL}”
}’

it’s ok?

Cuz when i load my docker on render get: BIOLOGY_APIS doesn’t exist (NoneType)