File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515
1616use GuzzleHttp \Handler \MockHandler ;
1717use Workbunny \WebmanNacos \Exception \NacosException ;
18+ use Workbunny \WebmanNacos \Exception \PluginDisableException ;
1819use Workbunny \WebmanNacos \Provider \ConfigProvider ;
1920use Workbunny \WebmanNacos \Provider \InstanceProvider ;
2021use Workbunny \WebmanNacos \Provider \OperatorProvider ;
@@ -69,6 +70,10 @@ class Client
6970 */
7071 public static function channel (string $ name = 'default ' ): Client
7172 {
73+ // 如果插件关闭,则抛出一个特定异常
74+ if (!config ('plugin.workbunny.webman-nacos.app.enable ' , true )) {
75+ throw new PluginDisableException ();
76+ }
7277 $ channel = config ('plugin.workbunny.webman-nacos.channel ' , []);
7378 if (empty ($ config = $ channel [$ name ] ?? [])){
7479 throw new NacosException ("Channel config $ name is invalid. " );
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * This file is part of workbunny.
4+ *
5+ * Redistributions of files must retain the above copyright notice.
6+ *
7+ * @author chaz6chez<chaz6chez1993@outlook.com>
8+ * @copyright chaz6chez<chaz6chez1993@outlook.com>
9+ * @link https://github.com/workbunny/webman-nacos
10+ * @license https://github.com/workbunny/webman-nacos/blob/main/LICENSE
11+ */
12+ declare (strict_types=1 );
13+
14+ namespace Workbunny \WebmanNacos \Exception ;
15+
16+ class PluginDisableException extends \RuntimeException
17+ {
18+ }
You can’t perform that action at this time.
0 commit comments