diff --git a/packages/framework/src/Foundation/Internal/LoadConfiguration.php b/packages/framework/src/Foundation/Internal/LoadConfiguration.php index 0e7aa8eb502..5060e292871 100644 --- a/packages/framework/src/Foundation/Internal/LoadConfiguration.php +++ b/packages/framework/src/Foundation/Internal/LoadConfiguration.php @@ -83,15 +83,8 @@ private function loadRuntimeConfiguration(Application $app, RepositoryContract $ { if ($app->runningInConsole()) { if ($this->getArgv() !== null) { - // Check if the `--pretty-urls` CLI argument is set, and if so, set the config value accordingly. - if (in_array('--pretty-urls', $this->getArgv(), true)) { - $repository->set('hyde.pretty_urls', true); - } - - // Check if the `--no-api` CLI argument is set, and if so, set the config value accordingly. - if (in_array('--no-api', $this->getArgv(), true)) { - $repository->set('hyde.api_calls', false); - } + $this->mergeCommandLineArguments($repository, '--pretty-urls', 'hyde.pretty_urls'); + $this->mergeCommandLineArguments($repository, '--no-api', 'hyde.api_calls'); } $this->mergeRealtimeCompilerEnvironment($repository, 'HYDE_SERVER_DASHBOARD', 'hyde.server.dashboard.enabled'); @@ -99,6 +92,13 @@ private function loadRuntimeConfiguration(Application $app, RepositoryContract $ } } + private function mergeCommandLineArguments(RepositoryContract $repository, string $argumentName, string $configKey): void + { + if (in_array($argumentName, $this->getArgv(), true)) { + $repository->set($configKey, true); + } + } + private function mergeRealtimeCompilerEnvironment(RepositoryContract $repository, string $environmentKey, string $configKey): void { if ($this->getEnv($environmentKey) !== false) {