mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-25 01:25:34 +08:00
fix read config before loaded
This commit is contained in:
@@ -97,7 +97,7 @@ class Framework
|
|||||||
$this->registerBaseBindings();
|
$this->registerBaseBindings();
|
||||||
|
|
||||||
// 初始化配置
|
// 初始化配置
|
||||||
ZMConfig::setDirectory($this->container->get('path.config'));
|
ZMConfig::setDirectory(app('path.config'));
|
||||||
ZMConfig::setEnv($args['env'] ?? '');
|
ZMConfig::setEnv($args['env'] ?? '');
|
||||||
if (ZMConfig::get('global') === false) {
|
if (ZMConfig::get('global') === false) {
|
||||||
echo zm_internal_errcode('E00007') . 'Global config load failed: ' . ZMConfig::$last_error . "\nError path: " . DataProvider::getSourceRootDir() . "\nPlease init first!\nSee: https://github.com/zhamao-robot/zhamao-framework/issues/37\n";
|
echo zm_internal_errcode('E00007') . 'Global config load failed: ' . ZMConfig::$last_error . "\nError path: " . DataProvider::getSourceRootDir() . "\nPlease init first!\nSee: https://github.com/zhamao-robot/zhamao-framework/issues/37\n";
|
||||||
@@ -624,7 +624,9 @@ class Framework
|
|||||||
$this->container->instance('path.source', DataProvider::getSourceRootDir());
|
$this->container->instance('path.source', DataProvider::getSourceRootDir());
|
||||||
$this->container->alias('path.source', 'path.base');
|
$this->container->alias('path.source', 'path.base');
|
||||||
$this->container->instance('path.config', DataProvider::getSourceRootDir() . '/config');
|
$this->container->instance('path.config', DataProvider::getSourceRootDir() . '/config');
|
||||||
$this->container->instance('path.module_config', ZMConfig::get('global', 'config_dir'));
|
$this->container->singleton('path.module_config', function () {
|
||||||
|
return ZMConfig::get('global', 'config_dir');
|
||||||
|
});
|
||||||
$this->container->singleton('path.data', function () {
|
$this->container->singleton('path.data', function () {
|
||||||
return DataProvider::getDataFolder();
|
return DataProvider::getDataFolder();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user