diff --git a/app/Console/Commands/HRCCommand.php b/app/Console/Commands/HRCCommand.php index fc9a953..b1bfadc 100644 --- a/app/Console/Commands/HRCCommand.php +++ b/app/Console/Commands/HRCCommand.php @@ -58,11 +58,21 @@ class HRCCommand extends Command file_put_contents($result_file, json_encode($result)); } + private function getCoreConfig($name) + { + $config = parse_ini_file(mb_strtolower(file_get_contents(CORE_PATH . '/../../db.ini'))); + return $config[$name]; + } + public function initDB() { $code = $this->option('unn'); DB::disconnect('mysql'); + Config::set('database.connections.mysql.username', $this->getCoreConfig('user')); + Config::set('database.connections.mysql.password', $this->getCoreConfig('password')); + Config::set('database.connections.mysql.host', $this->getCoreConfig('server')); + Config::set('database.connections.mysql.port', $this->getCoreConfig('port')); Config::set('database.connections.mysql.database', $code); DB::reconnect(); }