environment fix

This commit is contained in:
CHIEFSOFT\ameye
2026-01-04 14:26:51 -05:00
parent f1f0d1b3c1
commit 258e8f36c4
+37 -1
View File
@@ -1,4 +1,40 @@
# CodeIgniter 4 Framework # MERMS Media Render
## Important for environment switching to work
app/Config/Database.php
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
if (ENVIRONMENT === 'testing') {
$this->defaultGroup = 'tests';
}
if(ENVIRONMENT == 'production'){
$this->defaultGroup ='production';
}
}
system/Boot.php
protected static function loadDotEnv(Paths $paths): void
{
require_once $paths->systemDirectory . '/Config/DotEnv.php';
$env = $_ENV['CI_ENVIRONMENT'] ?? $_SERVER['CI_ENVIRONMENT']
?? getenv('CI_ENVIRONMENT')
?: 'production';
$env_file = '.env'; // default file
if ($env == 'production'){{
$env_file = '.env.live';
}}
(new DotEnv($paths->appDirectory . '/../', $env_file))->load();
}
## CodeIgniter 4 Framework
## What is CodeIgniter? ## What is CodeIgniter?