Welcome Guest, Not a member yet? Register   Sign In
Support for multiple .env file.

(This post was last modified: 12-26-2021, 03:24 AM by yahyaerturan.)

I was thinking it would be great to have different .env files in CI4.

Loading order: 
  1. .env
  2. .env.dev (optional file) (overrides keys from previous one if exist in this one).
  3. .env.prod (optional file) (overrides keys from previous ones if exist in this one).
  4. .env.test (optional file) (overrides keys from previous one if exist in this one).
When developing, CI use .env file to manipulate config files. But many developers use it in and extended manner.

For example, different mail api credentials for development and production.
  • Different slack webhook credentials for dev, test, and prod environments.
  • Different JWT secrets and/or ttl for dev, test, and prod environments.
  • For commands, different path to php definition for shared hosting accounts.
Can multiply scenarios. 

What I suggest is also being used somehow by Symfony and Laravel.

I wanted to override with a Config\DotEnv extend Codeigniter\Config\DotEnv but not recognized my file. Yet, also thinking should be a out-of-box feature. 

Thanks for your time.

Theme © iAndrew 2016 - Forum software by © MyBB