GitHub Session Secrets to .env

Hello all,

I am wanting to set my MONGO_URI variable in my GitHub repo, as that is where it is being deployed from.

The issue is: I really do not want to have to go through the whole process of setting up a GitHub Action just to set this one environment variable.

Naively, I tried doing this in my .env file:

MONGO_URI=${{ secrets.MONGO_URI }}

Is there any way of doing something similar? Even some hacky way of hiding my .env file from public view in GitHub, so I can set the variable directly…

Any help is appreciated.

Heya~!

Where are you hosting the site/app? Are you deploying with GitHub pages or using another service?

Hi, there.

The app is hosted on Heroku. It is deployed using GitHub integration with Heroku.

Thank you, for replying, but I have just found out Heroku have a config setting with environment variables.

1 Like