This seems to be working for me.
Keep all of your .env files in the rootpath (along side system and app folders)
Create a duplicate .env file and rename it to whatever suits your needs. (example: .env-dev)
In your /public/index.php add your custom env file name to a constant variable at the top:
PHP Code:
define('ENVFILE', '.env-dev'); // constant name and file name are your choice
In /system/bootstrap.php
change
PHP Code:
$env = new DotEnv(ROOTPATH);
to
PHP Code:
$env = new DotEnv(ROOTPATH, ENVFILE);
Boom!
With this change, if you have addon/sub domains, you would create a new env file in the rootpath. (example: .env-new)
In /public/new/index.php add your custom env file name to a constant variable at the top:
PHP Code:
define('ENVFILE', '.env-new');
// also change your pathsConfig near line 20
$pathsConfig = FCPATH . '../../app-new/Config/Paths.php'; // or whatever you named your app folder
Your addon / sub domain should now be looking at its own env file.
Maybe someone can chime in and give me any insight on the downside to doing it this way but it works!