refactor: remove force option from getSysConfig

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/807/head
Varun Patil 2023-09-03 09:26:54 -07:00
parent deef94f7cd
commit 0752081d15
4 changed files with 10 additions and 9 deletions

View File

@ -133,7 +133,7 @@ class AdminController extends GenericApiController
// Check for FFmpeg for preview generation
$status['ffmpeg_preview'] = $this->getExecutableStatus(
Util::getSystemConfig('preview_ffmpeg_path', null, true)
Util::getSystemConfig('preview_ffmpeg_path')
?: trim(shell_exec('which ffmpeg') ?: ''),
static fn ($p) => BinExt::testFFmpeg($p, 'ffmpeg'),
);

View File

@ -165,7 +165,7 @@ class BinExt
'vaapi' => Util::getSystemConfig('memories.vod.vaapi'),
'vaapiLowPower' => Util::getSystemConfig('memories.vod.vaapi.low_power'),
'nvenc' => Util::getSystemConfig('memories.vod.nvenc', false),
'nvenc' => Util::getSystemConfig('memories.vod.nvenc'),
'nvencTemporalAQ' => Util::getSystemConfig('memories.vod.nvenc.temporal_aq'),
'nvencScale' => Util::getSystemConfig('memories.vod.nvenc.scale'),

View File

@ -72,4 +72,8 @@ return [
'preview_max_y' => 4096,
'preview_max_memory' => 128,
'preview_max_filesize_image' => 50,
'preview_ffmpeg_path' => '',
// Placeholders only; these are not touched by the app
'instanceid' => 'default',
];

View File

@ -364,17 +364,14 @@ class Util
*
* @param string $key System config key
* @param null|mixed $default Default value
* @param bool $force Do not check if the key is valid
*/
public static function getSystemConfig(string $key, $default = null, bool $force = false)
public static function getSystemConfig(string $key, $default = null)
{
$config = \OC::$server->get(\OCP\IConfig::class);
$defaults = self::systemConfigDefaults();
if (!$force) {
if (!\array_key_exists($key, $defaults)) {
throw new \InvalidArgumentException("Invalid system config key: {$key}");
}
if (!\array_key_exists($key, $defaults)) {
throw new \InvalidArgumentException("Invalid system config key: {$key}");
}
return $config->getSystemValue($key, $default ?? $defaults[$key]);
@ -431,7 +428,7 @@ class Util
*/
public static function getInstanceId(): string
{
return self::getSystemConfig('instanceid', 'default', true);
return self::getSystemConfig('instanceid');
}
/**