Need help configuring .env file to connect to MongoDB Atlas

I am not a devops guy at all, and not much of a command line person… would be lovely to have UI access to the .env file to simply edit from the UI. Seems not to be available.

I think my needs are basic, configure the .env to connect to MongoDB Atlas and potentially to use Sentry for logging, etc.

Anyone have a moment to help? Cheers

You have to set the [env] in the fly.toml.
Under the [env] you set the variable, something like this:

MONGODB = ‘mongodb+srv…’

@Mrka I don’t think it’s wise to store connection string in [env] as it’s more suited for non-sensitive credential. This is clearly stated in Fly docs.

@mattchoo you would need to set your credentials by running fly secrets set MONGODB_URL="mongodb+srv://username:password@cluster.mongodb.net/database" . This is the only way to set your credentials safely as it’s securely stored in a vault.
In your dashboard, you can check if your key has been created only after deploying to a machine. This key will be encrypted for security reasons.

2 Likes

Yes, you’re right. I use [env] credentials for testing and developing before setting as secret.

1 Like

thank you for the response… just tried this and redeployed

seeing this in logs still

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