diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 33b839fc41..6b19c96be6 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -50,18 +50,6 @@ use Utopia\Validator\JSON; use Utopia\Validator\Text; use Utopia\Validator\WhiteList; -App::init() - ->groups(['api', 'database']) - ->inject('request') - ->inject('dbForProject') - ->action(function (Request $request, Database $dbForProject) { - $timeout = \intval($request->getHeader('x-appwrite-timeout')); - - if (!empty($timeout) && App::isDevelopment()) { - $dbForProject->setTimeout($timeout); - } - }); - App::post('/v1/databases') ->desc('Create database') ->groups(['api', 'database']) diff --git a/app/controllers/general.php b/app/controllers/general.php index fdef1e9cee..32323d6e05 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1576,6 +1576,20 @@ foreach (Config::getParam('services', []) as $service) { } } +// legacy controller init hooks as the endpoint controller logic is now moved to a module structure. +// 1. databases +App::init() + ->groups(['api', 'database']) + ->inject('request') + ->inject('dbForProject') + ->action(function (Request $request, Database $dbForProject) { + $timeout = \intval($request->getHeader('x-appwrite-timeout')); + + if (!empty($timeout) && App::isDevelopment()) { + $dbForProject->setTimeout($timeout); + } + }); + // Check for any errors found while we were initialising the SDK Methods. if (!empty(Method::getErrors())) { throw new \Exception('Errors found during SDK initialization:' . PHP_EOL . implode(PHP_EOL, Method::getErrors()));