[DEFAULTS] Small fixes and add check of SOCIAL_NO_RELOAD_DEFAULTS from the environment, to override the reloading of default values

This commit is contained in:
Hugo Sales 2020-06-24 22:59:36 +00:00 committed by Hugo Sales
parent 26c966084a
commit 6c0c84c284
2 changed files with 6 additions and 3 deletions

View File

@ -0,0 +1,3 @@
In the `dev` environment, the default values for the config table are reloaded on each HTTP request
In case you want to override this, add `SOCIAL_NO_RELOAD_DEFAULTS=1` to your .env.local file

View File

@ -274,7 +274,7 @@ abstract class DefaultSettings
'login_command' => ['enabled' => false],
];
self::loadDefaults(!$_ENV['APP_DEBUG']);
self::loadDefaults($_ENV['APP_ENV'] == 'prod');
}
public static function loadDefaults(bool $optimize = false)
@ -283,9 +283,9 @@ abstract class DefaultSettings
return;
}
// In debug mode, delete everything and reinsert, in case
// In dev mode, delete everything and reinsert, in case
// defaults changed
if ($_ENV['APP_DEBUG']) {
if ($_ENV['APP_ENV'] === 'dev' && !isset($_ENV['SOCIAL_NO_RELOAD_DEFAULTS'])) {
DB::getConnection()->executeQuery('delete from config;');
}