Cleanup config files if the db setup fails

This commit is contained in:
Nabeel Shahzad
2018-02-25 15:13:04 -06:00
parent 88e4c26b8f
commit d9abaa2f06
3 changed files with 31 additions and 1 deletions

View File

@@ -158,7 +158,9 @@ class InstallerController extends Controller
*/
public function envsetup(Request $request)
{
Log::info('ENV setup', $request->post());
$log_str = $request->post();
$log_str['password'] = '';
Log::info('ENV setup', $log_str);
// Before writing out the env file, test the DB credentials
try {
@@ -211,6 +213,7 @@ class InstallerController extends Controller
$console_out .= $this->dbService->setupDB();
$console_out .= $this->migrationSvc->runAllMigrations();
} catch(QueryException $e) {
$this->envService->removeConfigFiles();
flash()->error($e->getMessage());
return redirect(route('installer.step2'))->withInput();
}