support fetching variables from the .env file?

We are using a .env file for storing the key for mailersend gem because it requires a .env file. And fly.io does not support fetching variables from the .env file. When I try to deploy the code it gives an error for mailersend variable.

Hope you can help, thanks

dotenv is designed to load environment variables in development. The Dockerfile we provide will run your program in production.

They recommend that you don’t commit your .env file and that you use other mechanisms in production. For fly.io, that would be fly secrets.

I use the ‘[env]’ in the fly.toml for setting that are not secret.

And then I use ‘fly secrets set MY_VAR=theValueOfVar’ for secrets, which are passwords, keys, webhook endpoints that should be masked, personal contact data (like admin email).

https://infisical.com/ has support for some of what you are looking for - and they have an integration with Fly.io - check them out

thanks for all of the help, really appreciate it
have tried adding the env like this in fly.toml file, but still it does not work.

WhatsApp Image 2023-09-21 at 14.37.20

Thank again.

Hi, we used infisical and we are getting another error.

Hope you can help, thanks

it was gong well and we were following the infisical docs then we went to deploy to fly and go the error message, thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.