Skip to content

Commit 521078a

Browse files
committed
refactor: config path
1 parent c84cd69 commit 521078a

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/Console/Application.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ final class Application
1818
{
1919
public function __construct()
2020
{
21+
// Default config
22+
if(is_file(__DIR__ . '/../../../../../unitary.config.php')) {
23+
// From the vendor dir
24+
EmitronKernel::setConfigFilePath(__DIR__ . '/../../../../../unitary.config.php');
25+
} else {
26+
// From the repo dir
27+
EmitronKernel::setConfigFilePath(__DIR__ . '/../../unitary.config.php');
28+
}
2129
EmitronKernel::setRouterFilePath(__DIR__ . "/ConsoleRouter.php");
2230
}
2331

src/Console/Kernel.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525

2626
class Kernel
2727
{
28-
private const DEFAULT_ROUTER_FILE = '/src/Console/ConsoleRouter.php';
29-
public const UNITARY_DIR = __DIR__ . '/../../';
30-
public const DEFAULT_CONFIG_FILE_NAME = 'unitary.config.php';
31-
3228
private ContainerInterface $container;
3329
private array $userMiddlewares;
3430
private ?DispatchConfig $config;
@@ -48,16 +44,6 @@ public function __construct(
4844
$this->container = $container;
4945
$this->userMiddlewares = $userMiddlewares;
5046
$this->config = $dispatchConfig;
51-
52-
if(EmitronKernel::getRouterFilePath() === null) {
53-
if(is_file(__DIR__ . '/../../../../../unitary.config.php')) {
54-
// From the vendor dir
55-
EmitronKernel::setConfigFilePath(__DIR__ . '/../../../../../unitary.config');
56-
} else {
57-
// From the the repo dir
58-
EmitronKernel::setConfigFilePath(__DIR__ . '/../../unitary.config.php');
59-
}
60-
}
6147
}
6248

6349
/**

0 commit comments

Comments
 (0)