Auth\Db: add warning message with cause on initialization failure

This commit is contained in:
Benjamin Renard 2023-03-07 18:47:50 +01:00
parent fe19313c2f
commit 5ab7b35cc3

View file

@ -84,6 +84,10 @@ class Db extends Backend {
)
);
self :: $dsn = App::get('auth.db.dsn', null, 'string');
if (!self :: $dsn) {
Log :: warning('No database DSN configured, can not initialize this authentication backend');
return false;
}
self :: $user = App::get('auth.db.user', null, 'string');
self :: $password = App::get('auth.db.password', null, 'string');
self :: $options = App::get('auth.db.options', null, 'array');
@ -91,7 +95,7 @@ class Db extends Backend {
self :: $username_field = App::get('auth.db.username_field', null, 'string');
self :: $password_field = App::get('auth.db.password_field', null, 'string');
self :: $exposed_fields = App::get('auth.db.exposed_fields', null, 'array');
return boolval(self :: $dsn);
return true;
}
/**