vinkla / wordplate

A boilerplate for WordPress, built with Composer and designed with sensible defaults.
2.11k stars 155 forks source link

dot env file and environment #259

Closed azralth closed 4 years ago

azralth commented 4 years ago

Hi,

For my last projeect i'm using now WordPlate and I really wanted to thank you for that. But for now I would like to go further and setup different environment variable (developpment, production) and setup my database login according to.

have you planned something to go in this direction?

Actually the databasee login are in dot env file and i think it will be not secure to get the local and production database login in same file.

Other example, if i want to hide update only iin production server, it would be great to access to a variable "APP_ENV" in dot env file and do some stuff with this. I've search a while but can't find anything clear in documentation. Thanks !

vinkla commented 4 years ago

Hi @azralth, I'm glad you like WordPlate 😃

Actually the databasee login are in dot env file and i think it will be not secure to get the local and production database login in same file.

The .env can be unique for each environment. It shouldn't be committed to your repository. I keep a local version of the .env file with development credentials and one .env on the production server. You can read more about environment files here.

Other example, if i want to hide update only iin production server, it would be great to access to a variable "APP_ENV" in dot env file and do some stuff with this. I've search a while but can't find anything clear in documentation.

This is possible, you add APP_ENV to the .env file you can then access it using env('APP_ENV').