Skip to content

Commit 7541f7f

Browse files
committed
fix: resolve path to custom config file
1 parent 495b51c commit 7541f7f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Console/Kernel.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
class Kernel
2727
{
2828
private const DEFAULT_ROUTER_FILE = '/src/Console/ConsoleRouter.php';
29-
public const CONFIG_FILE_PATH = __DIR__ . '/../../unitary.config';
29+
public const UNITARY_DIR = __DIR__ . '/../../';
30+
public const DEFAULT_CONFIG_FILE_PATH = __DIR__ . '/../../unitary.config';
3031

3132
private ContainerInterface $container;
3233
private array $userMiddlewares;
@@ -47,7 +48,13 @@ public function __construct(
4748
$this->container = $container;
4849
$this->userMiddlewares = $userMiddlewares;
4950
$this->config = $dispatchConfig;
50-
EmitronKernel::setConfigFilePath(self::CONFIG_FILE_PATH);
51+
52+
if(is_file(self::UNITARY_DIR . '/../../../unitary.config.php')) {
53+
EmitronKernel::setConfigFilePath(self::UNITARY_DIR . '/../../../unitary.config');
54+
} else {
55+
EmitronKernel::setConfigFilePath(self::DEFAULT_CONFIG_FILE_PATH);
56+
}
57+
EmitronKernel::setRouterFilePath(self::UNITARY_DIR);
5158
}
5259

5360
/**

0 commit comments

Comments
 (0)