itsJava
itsJava

Reputation: 7

The basics of a ENV file

I’m using a hosting website to host my discord bot and my .env stores the token. How does it still work when the file is .gitignored? Because I don’t want people stealing my token and using it for other purposes.

Upvotes: 0

Views: 245

Answers (2)

lanxion
lanxion

Reputation: 1430

You use gitignore and add the .env extension in it to make sure that it does not get pushed to the remote repository on github so that no-one can access those variables. in order to add the .env variables on a hosting website, you need to add the environment variables externally on that hosting site. The method depends entirely on the service provider.

Upvotes: 0

Quentin
Quentin

Reputation: 944112

Your initial deployment process on your hosting needs to be more complex than "Pull the application from my Git repository".

For simple applications that generally just means you create the .env file on the hosting manually.

For complex systems (e.g. when you have multiple instances of the application on different servers) you'll generate it from a secure data store as part of a process that involves a deployment tool like Terraform.

Upvotes: 2

Related Questions