Fix some error conditions in installer; hide passwords in logs

This commit is contained in:
Nabeel Shahzad
2018-02-25 15:27:20 -06:00
parent d9abaa2f06
commit 4393523929
4 changed files with 21 additions and 10 deletions

View File

@@ -159,13 +159,17 @@ class InstallerController extends Controller
public function envsetup(Request $request)
{
$log_str = $request->post();
$log_str['password'] = '';
$log_str['db_pass'] = '';
Log::info('ENV setup', $log_str);
// Before writing out the env file, test the DB credentials
try {
$this->testDb($request);
} catch (\Exception $e) {
Log::error('Testing db before writing configs failed');
Log::error($e->getMessage());
flash()->error($e->getMessage());
return redirect(route('installer.step2'))->withInput();
}
@@ -191,6 +195,9 @@ class InstallerController extends Controller
try {
$this->envService->createConfigFiles($attrs);
} catch(FileException $e) {
Log::error('Config files failed to write');
Log::error($e->getMessage());
flash()->error($e->getMessage());
return redirect(route('installer.step2'))->withInput();
}
@@ -213,6 +220,8 @@ class InstallerController extends Controller
$console_out .= $this->dbService->setupDB();
$console_out .= $this->migrationSvc->runAllMigrations();
} catch(QueryException $e) {
Log::error('Error on db setup: ' . $e->getMessage());
$this->envService->removeConfigFiles();
flash()->error($e->getMessage());
return redirect(route('installer.step2'))->withInput();