(08-24-2024, 07:45 PM)kenjis Wrote: Try
PHP Code:
(new DotEnv($paths->appDirectory . '/../'))->load();
hi kenjis..i have try that..but not work..
DotEnv successfuly load the new .env, but the configuration DB still use default value,not use value from the new .env
step
1. first i dont have .env,
So i Running in first time the CLI ,and i Check the config DB in this case CI automatic load default config DB.
2. i run my command to automaticly generate .env , load that with DotEnv ,
and check again with config:check Database, but the value config DB not change.
Code:
//step Checking first time config db
CLI::wait(2);
CLI::write('Checking first time config db`...', 'black', 'green');
command('config:check Database');
//step 2 Generate env
CLI::wait(2);
CLI::write('Generate env `key:generate`...', 'black', 'green');
$this->call('key:generate');
//passing value in .env
CLI::wait(2);
CLI::write('Running `passing value env`...', 'black', 'green');
$this->setEnv($domain, $dbHost, $dbName, $dbUser, $dbPassword, $driver, $port);
CLI::showProgress($currStep++, $totalSteps);
//step 3 clear cache
CLI::wait(2);
CLI::write('Running `Clear Cache`...', 'black', 'green');
command('cache:clear');
//step 4 load New ENV
CLI::wait(2);
CLI::write('Load `Env`...', 'black', 'green');
$paths = new Paths();
(new DotEnv($paths->appDirectory . '/../'))->load();
//step 5 Checking if config DB has change with new ENV
CLI::wait(2);
CLI::write('Checking if config DB has change with new ENV', 'black', 'green');
command('config:check Database');
die; //stop just testing
the .env has generate n load.but the config not change