Hello,
Iām using strapi with Docker.
How can I use my .env variables in app/config/functions/cron.js
?
process.env.VAR_NAME
doesnt working for me.
Hello,
Iām using strapi with Docker.
How can I use my .env variables in app/config/functions/cron.js
?
process.env.VAR_NAME
doesnt working for me.
Ok, I need add VAR_NAME
on my docker-compose.yml
environment.
environment:
MY_VAR: ${MY_VAR}
Now, I can access process.env.MY_VAR
.
Additionally, if you really want to use the .env
file, You can add this to your docker-compose.yml
file:
env_file:
- <path_to_file>/.env
So if docker-compose.yml lives in the same directory as .env
then you can leave out <path_to_file>/
in my example above.
My pleasure!