diff --git a/src/Frontier.php b/src/Frontier.php index fd39e60..6b8c0d2 100644 --- a/src/Frontier.php +++ b/src/Frontier.php @@ -11,6 +11,10 @@ class Frontier { public static function add(array $config): void { + if (empty($config['enabled'])) { + return; + } + match ($config['type']) { 'http' => self::http($config), 'proxy' => self::proxy($config), diff --git a/tests/Unit/DisableTest.php b/tests/Unit/DisableTest.php new file mode 100644 index 0000000..e7d4314 --- /dev/null +++ b/tests/Unit/DisableTest.php @@ -0,0 +1,24 @@ + false, + 'type' => 'proxy', + 'host' => 'frontier.test', + 'rules' => [ + '/disabled::exact', + ], + ]); + + Http::fake([ + 'frontier.test/disabled' => Http::response('Frontier is disabled'), + ]); + + $this->get('disabled') + ->assertNotFound(); +});