From 258e8f36c46618badac6388ec06b6e9a09a3d467 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 4 Jan 2026 14:26:51 -0500 Subject: [PATCH] environment fix --- README.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a23783a..6931b16 100644 --- a/README.md +++ b/README.md @@ -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?