mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 01:18:37 +00:00
update: move the init hook.
This commit is contained in:
parent
b3b9961860
commit
9c1ec6fe02
2 changed files with 14 additions and 12 deletions
|
|
@ -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'])
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
|
|
|
|||
Loading…
Reference in a new issue