diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 06b8b139e5..2b655ab5d8 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -381,15 +381,6 @@ function updateAttribute( return $attribute; } -App::init() - ->groups(['database', 'function', 'storage', 'messaging']) - ->inject('project') - ->action(function (Document $project) { - if ($project->getId() === 'console') { - throw new Exception(Exception::PROJECT_RESERVED_PROJECT, 'Please check X-Appwrite-Project header'); - } - }); - App::init() ->groups(['api', 'database']) ->inject('request') diff --git a/app/controllers/general.php b/app/controllers/general.php index 20848da47e..53818fd136 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -5,6 +5,7 @@ require_once __DIR__ . '/../init.php'; use Appwrite\Event\Certificate; use Appwrite\Event\Event; use Appwrite\Event\Usage; +use Appwrite\Extend\Exception; use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Network\Validator\Origin; use Appwrite\Utopia\Request; @@ -357,6 +358,15 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo return false; } +App::init() + ->groups(['database', 'function', 'storage', 'messaging']) + ->inject('project') + ->action(function (Document $project) { + if ($project->getId() === 'console') { + throw new Exception(Exception::PROJECT_RESERVED_PROJECT, 'Please check X-Appwrite-Project header'); + } + }); + App::init() ->groups(['api', 'web']) ->inject('utopia')