From f850afdc2ae5128fe1d3bd5ffd4c3c982d1adff1 Mon Sep 17 00:00:00 2001 From: wewall <33481440+wewall@users.noreply.github.com> Date: Sat, 31 Aug 2019 17:23:55 +0800 Subject: [PATCH] refactor(config): Use existing define --- app/Services/Boot.php | 5 +---- config/.config.example.php | 2 +- config/routes.php | 10 ++-------- test/config.php | 2 +- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/Services/Boot.php b/app/Services/Boot.php index fb3c7465..a969357f 100644 --- a/app/Services/Boot.php +++ b/app/Services/Boot.php @@ -8,10 +8,7 @@ class Boot { public static function setDebug() { - // debug - if (Config::get('debug') == 'true') { - define('DEBUG', true); - } + define('DEBUG', Config::get('debug')); View::$beginTime = microtime(true); } diff --git a/config/.config.example.php b/config/.config.example.php index ec61aeba..aaa5920e 100644 --- a/config/.config.example.php +++ b/config/.config.example.php @@ -16,7 +16,7 @@ $System_Config['version']='1'; //仅当涉及【需要修改config以外的文 //基本设置-------------------------------------------------------------------------------------------- $System_Config['key'] = '1145141919810'; //!!! 瞎 jb 修改此key为随机字符串确保网站安全 !!! -$System_Config['debug'] = 'false'; //正式环境请确保为 false +$System_Config['debug'] = false; //正式环境请确保为 false $System_Config['appName'] = 'sspanel'; //站点名称 $System_Config['baseUrl'] = 'http://url.com'; //站点地址 $System_Config['subUrl'] = $System_Config['baseUrl'].'/link/'; //订阅地址,如需和站点名称相同,请不要修改 diff --git a/config/routes.php b/config/routes.php index 1fed451a..29b1f721 100755 --- a/config/routes.php +++ b/config/routes.php @@ -9,17 +9,11 @@ use App\Middleware\Mu; use App\Middleware\Mod_Mu; use Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware; -// config -$debug = false; -if (defined('DEBUG')) { - $debug = true; -} - $configuration = [ 'settings' => [ - 'debug' => $debug, + 'debug' => DEBUG, 'whoops.editor' => 'sublime', - 'displayErrorDetails' => $debug + 'displayErrorDetails' => DEBUG ] ]; diff --git a/test/config.php b/test/config.php index 2f8264e3..764be7a0 100755 --- a/test/config.php +++ b/test/config.php @@ -16,7 +16,7 @@ $System_Config['version']='1'; //仅当涉及【需要修改config以外的文 //基本设置-------------------------------------------------------------------------------------------- $System_Config['key'] = '1145141919810'; //!!! 瞎 jb 修改此key为随机字符串确保网站安全 !!! -$System_Config['debug'] = 'true'; //正式环境请确保为 false +$System_Config['debug'] = true; //正式环境请确保为 false $System_Config['appName'] = 'sspanel uim test'; //站点名称 $System_Config['baseUrl'] = 'http://sspanel.host:23480'; //站点地址 $System_Config['subUrl'] = $System_Config['baseUrl'].'/link/'; //订阅地址,如需和站点名称相同,请不要修改