environment fix
This commit is contained in:
@@ -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?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user