Quick question how to get the .env conf file into the server. I have three settings file in my project base, development, production. I think testing and staging is an overkill
It is encouraged to put .env in .gitignore file. so it won't be included in version control. in Heroku, it is easy to set the environment variable in the settings tab. what about other hosting services without such a feature? since I push to my repository and pull from the server, How I am I suppose to get the API keys stored in the .env since it will ignore it (it's in gitignore) file? should I create in the server? or is there a way it is done? Newbie question I know.
You should put your . env file in . gitignore and create . env file on server manually - either by connecting to server (SSH) and creating file or transfer file using one of secure transfer protocols (SCP, SFTP).
You can create an. env file in the application's root directory that contains key/value pairs defining the project's required environment variables.
You can create a . env file in the root directory of the application, which contains key/value pairs defining the needed environment variables for your project. This . env file is then read by the dotenv library and appended to process.
You are correct. You should put your .env
file in .gitignore
and create .env
file on server manually - either by connecting to server (SSH) and creating file or transfer file using one of secure transfer protocols (SCP, SFTP).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With