Fix some error conditions in installer; hide passwords in logs
This commit is contained in:
parent
d9abaa2f06
commit
4393523929
@ -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();
|
||||
|
@ -45,10 +45,7 @@
|
||||
<td>Database Host</td>
|
||||
<td style="text-align:center;">
|
||||
<div class="form-group">
|
||||
{!! Form::text('db_host', null, [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'localhost',
|
||||
]) !!}
|
||||
{!! Form::input('text', 'db_host', '127.0.0.1', ['class' => 'form-control']) !!}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace Modules\Installer\Services;
|
||||
|
||||
use Log;
|
||||
use PDO;
|
||||
use Nwidart\Modules\Support\Stub;
|
||||
use Illuminate\Encryption\Encrypter;
|
||||
use Log;
|
||||
use Nwidart\Modules\Support\Stub;
|
||||
use PDO;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
||||
|
||||
/**
|
||||
|
@ -9,12 +9,17 @@ class DatabaseService {
|
||||
|
||||
/**
|
||||
* Check the PHP version that it meets the minimum requirement
|
||||
* @throws \PDOException
|
||||
* @param $driver
|
||||
* @param $host
|
||||
* @param $port
|
||||
* @param $name
|
||||
* @param $user
|
||||
* @param $pass
|
||||
* @return boolean
|
||||
*/
|
||||
public function checkDbConnection($driver, $host, $port, $name, $user, $pass)
|
||||
{
|
||||
Log::info('Testing Connection: '.$driver.'::'.$user.':'.$pass.'@'.$host.':'.$port.';'.$name);
|
||||
Log::info('Testing Connection: '.$driver.'::'.$user.':<hidden>@'.$host.':'.$port.';'.$name);
|
||||
|
||||
if($driver === 'mysql') {
|
||||
$dsn = "mysql:host=$host;port=$port;dbname=$name";
|
||||
|
Loading…
Reference in New Issue
Block a user