From c7281af6e2d14d21e15002e51cf4d7c461e9b3b6 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 11 Apr 2024 10:28:16 +0300 Subject: [PATCH] Move App::init to general.php --- app/controllers/api/databases.php | 9 --------- app/controllers/general.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) 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')