Skip to content

Commit 38b8b3c

Browse files
committed
Refresh db config after setting up .env
1 parent 3053e96 commit 38b8b3c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

app/system/Bakery/Command/Setup.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6363
// There might not be any `.env` file because there may be some custom config or global env values defined on the server.
6464
// We'll check for that. If the configs are empty, we'll assume nothing is defined and go strait to setup.
6565
if (!$force && $config["db.default.host"] != "" && $config["db.default.database"] != "" && $config["db.default.username"] != "") {
66-
$this->io->note("File `{$this->envPath}` was not found, but some database configuraiton are present. If this is not right, use -f option to force setup to run.");
66+
$this->io->note("File `{$this->envPath}` was not found, but some database configuration are present. Global system environment variable might be defined. If this is not right, use -f option to force setup to run.");
6767
return;
6868
}
6969

@@ -155,6 +155,11 @@ public function setupEnv()
155155

156156
// Let's save this config
157157
file_put_contents($this->envPath, $fileContent);
158+
159+
// At this point, `$this->uf` is still using the old configs.
160+
// We need to refresh the `db.default` config values
161+
$newConfig = array_merge($config['db.default'], $dbParams);
162+
$this->ci->config->set("db.default", $newConfig);
158163
}
159164

160165
/**

0 commit comments

Comments
 (0)