refactor: move DotEnv::load() from system/bootstrap.php

This commit is contained in:
kenjis 2022-05-07 13:18:24 +09:00
parent b6a27dc512
commit e2e94e8f0d
No known key found for this signature in database
GPG Key ID: BD254878922AF198
3 changed files with 12 additions and 7 deletions

View File

@ -29,6 +29,12 @@ $bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'boo
require $bootstrap;
// Load environment settings from .env files into $_SERVER and $_ENV
require_once SYSTEMPATH . 'Config/DotEnv.php';
$env = new CodeIgniter\Config\DotEnv(ROOTPATH);
$env->load();
/*
* ---------------------------------------------------------------
* GRAB OUR CODEIGNITER INSTANCE

6
spark
View File

@ -62,6 +62,12 @@ $bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'boo
require $bootstrap;
// Load environment settings from .env files into $_SERVER and $_ENV
require_once SYSTEMPATH . 'Config/DotEnv.php';
$env = new CodeIgniter\Config\DotEnv(ROOTPATH);
$env->load();
$app = Config\Services::codeigniter();
$app->initialize();
$app->setContext('spark');

View File

@ -9,7 +9,6 @@
* the LICENSE file that was distributed with this source code.
*/
use CodeIgniter\Config\DotEnv;
use Config\Autoload;
use Config\Modules;
use Config\Paths;
@ -123,11 +122,5 @@ if (is_file(COMPOSER_PATH)) {
require_once COMPOSER_PATH;
}
// Load environment settings from .env files into $_SERVER and $_ENV
require_once SYSTEMPATH . 'Config/DotEnv.php';
$env = new DotEnv(ROOTPATH);
$env->load();
// Always load the URL helper, it should be used in most of apps.
helper('url');