diff --git a/app/Bootstrap/ConfigComposer.php b/app/Bootstrap/ConfigComposer.php index 96b3fc9..d1558ca 100644 --- a/app/Bootstrap/ConfigComposer.php +++ b/app/Bootstrap/ConfigComposer.php @@ -27,6 +27,6 @@ class ConfigComposer */ public function __invoke(): void { - $this->container->set(Config::class, new Config('app/config')); + $this->container->set(Config::class, Config::createFromDirectory('app/config')); } } diff --git a/app/Bootstrap/FinderComposer.php b/app/Bootstrap/FinderComposer.php index ada314a..dc1205f 100644 --- a/app/Bootstrap/FinderComposer.php +++ b/app/Bootstrap/FinderComposer.php @@ -41,12 +41,12 @@ class FinderComposer public function __invoke(): void { $finder = Finder::create()->depth(0)->followLinks(); - $finder->ignoreVCS($this->config->get('ignore_vcs_files', false)); + $finder->ignoreVCS($this->config->get('app.ignore_vcs_files', false)); $finder->filter(function (SplFileInfo $file) { return ! $this->hiddenFiles()->contains($file->getRealPath()); }); - $sortOrder = $this->config->get('sort_order', 'name'); + $sortOrder = $this->config->get('app.sort_order', 'name'); if ($sortOrder instanceof Closure) { $finder->sort($sortOrder); } else { @@ -74,7 +74,7 @@ class FinderComposer } } - if ($this->config->get('reverse_sort', false)) { + if ($this->config->get('app.reverse_sort', false)) { $finder->reverseSorting(); } @@ -89,8 +89,8 @@ class FinderComposer protected function hiddenFiles(): Collection { return Collection::make( - $this->config->get('hidden_files', []) - )->when($this->config->get('hide_app_files', true), function (Collection $collection) { + $this->config->get('app.hidden_files', []) + )->when($this->config->get('app.hide_app_files', true), function (Collection $collection) { return $collection->merge(self::APP_FILES); })->map(function (string $file) { return glob($file, GLOB_BRACE | GLOB_NOSORT); diff --git a/app/Bootstrap/ViewComposer.php b/app/Bootstrap/ViewComposer.php index 1f4b558..d85846c 100644 --- a/app/Bootstrap/ViewComposer.php +++ b/app/Bootstrap/ViewComposer.php @@ -35,14 +35,14 @@ class ViewComposer */ public function __invoke(): void { - $twig = new Twig("app/themes/{$this->config->get('theme', 'default')}"); + $twig = new Twig("app/themes/{$this->config->get('app.theme', 'default')}"); $twig->getEnvironment()->setCache( - $this->config->get('view_cache', 'app/cache/views') + $this->config->get('cache.view_cache', 'app/cache/views') ); $twig->getEnvironment()->getExtension(CoreExtension::class)->setDateFormat( - $this->config->get('date_format', 'Y-m-d H:i:s'), '%d days' + $this->config->get('app.date_format', 'Y-m-d H:i:s'), '%d days' ); $this->registerGlobalFunctions($twig); diff --git a/app/Controllers/FileInfoController.php b/app/Controllers/FileInfoController.php index 1d75724..94e93c3 100644 --- a/app/Controllers/FileInfoController.php +++ b/app/Controllers/FileInfoController.php @@ -34,7 +34,7 @@ class FileInfoController } $file = new SplFileInfo($path); - if ($file->getSize() >= $this->config->get('max_hash_size', 1000000000)) { + if ($file->getSize() >= $this->config->get('app.max_hash_size', 1000000000)) { return $response->withStatus(500, 'File size too large'); }