Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit aa26784

Browse files
committed
routes list moved to sub array under routes config
1 parent 44cd7c3 commit aa26784

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/Application.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class Application implements RequestHandlerInterface
4242
private $requestedMethod;
4343
private $requestedPath;
4444
private $route;
45-
private $environment;
4645

4746
public function __construct(
4847
string $id,
@@ -54,7 +53,6 @@ public function __construct(
5453
$this->config = $config;
5554
$this->router = $router;
5655
$this->container = $container;
57-
$this->environment = $this->config->get('app')->get('environment', 'dev');
5856
}
5957

6058
public static function createWithContainer(ContainerInterface $container, ?string $id = 'selami-app') : self
@@ -122,14 +120,12 @@ private function getRoute() : Route
122120
$appConfig = $this->config->get('app');
123121
$this->router = $this->router
124122
->withSubFolder($appConfig->get('app_sub_folder', ''));
125-
if ($this->environment === 'prod'
126-
|| $appConfig->get('router_cache_enabled', false) === true
127-
) {
123+
if ($appConfig->get('router_cache_enabled', false) === true) {
128124
$cacheFile = $appConfig->get('cache_dir').'/'.$this->id.'.fastroute.cache';
129125
$this->router = $this->router
130126
->withCacheFile($cacheFile);
131127
}
132-
$this->addRoutes($this->config->get('routes'));
128+
$this->addRoutes($this->config->get('routes')->get($this->id));
133129
return $this->route ?? $this->router->getRoute();
134130
}
135131

0 commit comments

Comments
 (0)