From 83f7069a37f310822d6f51c7fa7bab5238f8352b Mon Sep 17 00:00:00 2001 From: TIGERB Date: Sat, 23 Mar 2019 21:54:47 +0800 Subject: [PATCH] fix(src/Manager): fix load .env :bug: --- src/Manager.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Manager.php b/src/Manager.php index 75fb082..5f2dd2d 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -192,7 +192,7 @@ public function welcome() An object-oriented multi process manager for PHP -Version: 0.3.5 +Version: 0.5.0 \033[0m WELCOME; @@ -205,7 +205,17 @@ public function welcome() */ private function loadEnv() { - $this->env = parse_ini_file(__DIR__ . '/../.env', true); + $envPath = __DIR__ . '/../'; + if (!file_exists($envPath . '.env')) { + copy($envPath . '.env.example', $envPath . '.env'); + } + if (!$this->env = parse_ini_file($envPath . '.env', true)) { + ProcessException::error([ + 'msg' => [ + 'msg' => 'Parse ini file fail', + ] + ]); + } } /**