From c35ecec63c2c363b8ad28b74ed348549ac204cd6 Mon Sep 17 00:00:00 2001 From: walkor Date: Mon, 10 Jan 2022 16:21:51 +0800 Subject: [PATCH] Fix command route:list error --- composer.json | 2 +- start.php | 9 --------- support/bootstrap.php | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 855e92a..a504146 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require": { "php": ">=7.2", - "workerman/webman-framework": "^1.2", + "workerman/webman-framework": "^1.2.1", "monolog/monolog": "^2.0" }, "suggest": { diff --git a/start.php b/start.php index ef443ac..64910be 100644 --- a/start.php +++ b/start.php @@ -66,16 +66,7 @@ $worker->onWorkerStart = function ($worker) { require_once base_path() . '/support/bootstrap.php'; $app = new App($worker, Container::instance(), Log::channel('default'), app_path(), public_path()); - Route::load(config_path()); - Middleware::load(config('middleware', [])); - foreach (config('plugin', []) as $firm => $projects) { - foreach ($projects as $name => $project) { - Middleware::load($project['middleware'] ?? []); - } - } - Middleware::load(['__static__' => config('static.middleware', [])]); Http::requestClass(Request::class); - $worker->onMessage = [$app, 'onMessage']; }; diff --git a/support/bootstrap.php b/support/bootstrap.php index d46b1f4..796e6bf 100644 --- a/support/bootstrap.php +++ b/support/bootstrap.php @@ -13,7 +13,10 @@ */ use Dotenv\Dotenv; +use support\Container; use Webman\Config; +use Webman\Route; +use Webman\Middleware; $worker = $worker ?? null; @@ -49,6 +52,19 @@ include_once $file; } +$container = Container::instance(); +Route::container($container); +Middleware::container($container); + +Route::load(config_path()); +Middleware::load(config('middleware', [])); +foreach (config('plugin', []) as $firm => $projects) { + foreach ($projects as $name => $project) { + Middleware::load($project['middleware'] ?? []); + } +} +Middleware::load(['__static__' => config('static.middleware', [])]); + foreach (config('bootstrap', []) as $class_name) { /** @var \Webman\Bootstrap $class_name */ $class_name::start($worker); @@ -62,3 +78,4 @@ } } } +