Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions app/controllers/api/health.php
Original file line number Diff line number Diff line change
Expand Up @@ -945,18 +945,18 @@
contentType: ContentType::JSON
))
->param('name', '', new WhiteList([
Event::DATABASE_QUEUE_NAME,
Event::DELETE_QUEUE_NAME,
Event::AUDITS_QUEUE_NAME,
Event::MAILS_QUEUE_NAME,
Event::FUNCTIONS_QUEUE_NAME,
Event::STATS_RESOURCES_QUEUE_NAME,
Event::STATS_USAGE_QUEUE_NAME,
Event::WEBHOOK_QUEUE_NAME,
Event::CERTIFICATES_QUEUE_NAME,
Event::BUILDS_QUEUE_NAME,
Event::MESSAGING_QUEUE_NAME,
Event::MIGRATIONS_QUEUE_NAME
System::getEnv('_APP_DATABASE_QUEUE_NAME', Event::DATABASE_QUEUE_NAME),
System::getEnv('_APP_DELETE_QUEUE_NAME', Event::DELETE_QUEUE_NAME),
System::getEnv('_APP_AUDITS_QUEUE_NAME', Event::AUDITS_QUEUE_NAME),
System::getEnv('_APP_MAILS_QUEUE_NAME', Event::MAILS_QUEUE_NAME),
System::getEnv('_APP_FUNCTIONS_QUEUE_NAME', Event::FUNCTIONS_QUEUE_NAME),
System::getEnv('_APP_STATS_RESOURCES_QUEUE_NAME', Event::STATS_RESOURCES_QUEUE_NAME),
System::getEnv('_APP_STATS_USAGE_QUEUE_NAME', Event::STATS_USAGE_QUEUE_NAME),
System::getEnv('_APP_WEBHOOK_QUEUE_NAME', Event::WEBHOOK_QUEUE_NAME),
System::getEnv('_APP_CERTIFICATES_QUEUE_NAME', Event::CERTIFICATES_QUEUE_NAME),
System::getEnv('_APP_BUILDS_QUEUE_NAME', Event::BUILDS_QUEUE_NAME),
System::getEnv('_APP_MESSAGING_QUEUE_NAME', Event::MESSAGING_QUEUE_NAME),
System::getEnv('_APP_MIGRATIONS_QUEUE_NAME', Event::MIGRATIONS_QUEUE_NAME)
]), 'The name of the queue')
->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true)
->inject('response')
Expand Down Expand Up @@ -993,18 +993,18 @@

/** @var Event $queue */
$queue = match ($name) {
Event::DATABASE_QUEUE_NAME => $queueForDatabase,
Event::DELETE_QUEUE_NAME => $queueForDeletes,
Event::AUDITS_QUEUE_NAME => $queueForAudits,
Event::MAILS_QUEUE_NAME => $queueForMails,
Event::FUNCTIONS_QUEUE_NAME => $queueForFunctions,
Event::STATS_RESOURCES_QUEUE_NAME => $queueForStatsResources,
Event::STATS_USAGE_QUEUE_NAME => $queueForStatsUsage,
Event::WEBHOOK_QUEUE_NAME => $queueForWebhooks,
Event::CERTIFICATES_QUEUE_NAME => $queueForCertificates,
Event::BUILDS_QUEUE_NAME => $queueForBuilds,
Event::MESSAGING_QUEUE_NAME => $queueForMessaging,
Event::MIGRATIONS_QUEUE_NAME => $queueForMigrations,
System::getEnv('_APP_DATABASE_QUEUE_NAME', Event::DATABASE_QUEUE_NAME) => $queueForDatabase,
System::getEnv('_APP_DELETE_QUEUE_NAME', Event::DELETE_QUEUE_NAME) => $queueForDeletes,
System::getEnv('_APP_AUDITS_QUEUE_NAME', Event::AUDITS_QUEUE_NAME) => $queueForAudits,
System::getEnv('_APP_MAILS_QUEUE_NAME', Event::MAILS_QUEUE_NAME) => $queueForMails,
System::getEnv('_APP_FUNCTIONS_QUEUE_NAME', Event::FUNCTIONS_QUEUE_NAME) => $queueForFunctions,
System::getEnv('_APP_STATS_RESOURCES_QUEUE_NAME', Event::STATS_RESOURCES_QUEUE_NAME) => $queueForStatsResources,
System::getEnv('_APP_STATS_USAGE_QUEUE_NAME', Event::STATS_USAGE_QUEUE_NAME) => $queueForStatsUsage,
System::getEnv('_APP_WEBHOOK_QUEUE_NAME', Event::WEBHOOK_QUEUE_NAME) => $queueForWebhooks,
System::getEnv('_APP_CERTIFICATES_QUEUE_NAME', Event::CERTIFICATES_QUEUE_NAME) => $queueForCertificates,
System::getEnv('_APP_BUILDS_QUEUE_NAME', Event::BUILDS_QUEUE_NAME) => $queueForBuilds,
System::getEnv('_APP_MESSAGING_QUEUE_NAME', Event::MESSAGING_QUEUE_NAME) => $queueForMessaging,
System::getEnv('_APP_MIGRATIONS_QUEUE_NAME', Event::MIGRATIONS_QUEUE_NAME) => $queueForMigrations,
};
$failed = $queue->getSize(failed: true);

Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Appwrite\Event;

use Utopia\Queue\Publisher;
use Utopia\System\System;

class Audit extends Event
{
Expand All @@ -19,8 +20,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::AUDITS_QUEUE_NAME)
->setClass(Event::AUDITS_CLASS_NAME);
->setQueue(System::getEnv('_APP_AUDITS_QUEUE_NAME', Event::AUDITS_QUEUE_NAME))
->setClass(System::getEnv('_APP_AUDITS_CLASS_NAME', Event::AUDITS_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Utopia\Config\Config;
use Utopia\Database\Document;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class Build extends Event
{
Expand All @@ -18,8 +19,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::BUILDS_QUEUE_NAME)
->setClass(Event::BUILDS_CLASS_NAME);
->setQueue(System::getEnv('_APP_BUILDS_QUEUE_NAME', Event::BUILDS_QUEUE_NAME))
->setClass(System::getEnv('_APP_BUILDS_CLASS_NAME', Event::BUILDS_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Utopia\Database\Document;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class Certificate extends Event
{
Expand All @@ -16,8 +17,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::CERTIFICATES_QUEUE_NAME)
->setClass(Event::CERTIFICATES_CLASS_NAME);
->setQueue(System::getEnv('_APP_CERTIFICATES_QUEUE_NAME', Event::CERTIFICATES_QUEUE_NAME))
->setClass(System::getEnv('_APP_CERTIFICATES_CLASS_NAME', Event::CERTIFICATES_CLASS_NAME));
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Appwrite/Event/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Utopia\Database\Document;
use Utopia\DSN\DSN;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class Database extends Event
{
Expand All @@ -24,7 +25,7 @@ public function __construct(protected Publisher $publisher)
{
parent::__construct($publisher);

$this->setClass(Event::DATABASE_CLASS_NAME);
$this->setClass(System::getEnv('_APP_DATABASE_CLASS_NAME', Event::DATABASE_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Utopia\Database\Document;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class Delete extends Event
{
Expand All @@ -20,8 +21,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::DELETE_QUEUE_NAME)
->setClass(Event::DELETE_CLASS_NAME);
->setQueue(System::getEnv('_APP_DELETE_QUEUE_NAME', Event::DELETE_QUEUE_NAME))
->setClass(System::getEnv('_APP_DELETE_CLASS_NAME', Event::DELETE_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Utopia\Config\Config;
use Utopia\Database\Document;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class Func extends Event
{
Expand All @@ -25,8 +26,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::FUNCTIONS_QUEUE_NAME)
->setClass(Event::FUNCTIONS_CLASS_NAME);
->setQueue(System::getEnv('_APP_FUNCTIONS_QUEUE_NAME', Event::FUNCTIONS_QUEUE_NAME))
->setClass(System::getEnv('_APP_FUNCTIONS_CLASS_NAME', Event::FUNCTIONS_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Utopia\Config\Config;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class Mail extends Event
{
Expand All @@ -24,8 +25,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::MAILS_QUEUE_NAME)
->setClass(Event::MAILS_CLASS_NAME);
->setQueue(System::getEnv('_APP_MAILS_QUEUE_NAME', Event::MAILS_QUEUE_NAME))
->setClass(System::getEnv('_APP_MAILS_CLASS_NAME', Event::MAILS_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Utopia\Database\Document;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class Messaging extends Event
{
Expand All @@ -19,8 +20,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::MESSAGING_QUEUE_NAME)
->setClass(Event::MESSAGING_CLASS_NAME);
->setQueue(System::getEnv('_APP_MESSAGING_QUEUE_NAME', Event::MESSAGING_QUEUE_NAME))
->setClass(System::getEnv('_APP_MESSAGING_CLASS_NAME', Event::MESSAGING_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Utopia\Config\Config;
use Utopia\Database\Document;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class Migration extends Event
{
Expand All @@ -16,8 +17,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::MIGRATIONS_QUEUE_NAME)
->setClass(Event::MIGRATIONS_CLASS_NAME);
->setQueue(System::getEnv('_APP_MIGRATIONS_QUEUE_NAME', Event::MIGRATIONS_QUEUE_NAME))
->setClass(System::getEnv('_APP_MIGRATIONS_CLASS_NAME', Event::MIGRATIONS_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/StatsResources.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Appwrite\Event;

use Utopia\Queue\Publisher;
use Utopia\System\System;

class StatsResources extends Event
{
Expand All @@ -13,8 +14,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::STATS_RESOURCES_QUEUE_NAME)
->setClass(Event::STATS_RESOURCES_CLASS_NAME);
->setQueue(System::getEnv('_APP_STATS_RESOURCES_QUEUE_NAME', Event::STATS_RESOURCES_QUEUE_NAME))
->setClass(System::getEnv('_APP_STATS_RESOURCES_CLASS_NAME', Event::STATS_RESOURCES_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/StatsUsage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Utopia\Database\Document;
use Utopia\Queue\Publisher;
use Utopia\System\System;

class StatsUsage extends Event
{
Expand All @@ -18,8 +19,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::STATS_USAGE_QUEUE_NAME)
->setClass(Event::STATS_USAGE_CLASS_NAME);
->setQueue(System::getEnv('_APP_STATS_USAGE_QUEUE_NAME', Event::STATS_USAGE_QUEUE_NAME))
->setClass(System::getEnv('_APP_STATS_USAGE_CLASS_NAME', Event::STATS_USAGE_CLASS_NAME));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Appwrite/Event/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Appwrite\Event;

use Utopia\Queue\Publisher;
use Utopia\System\System;

class Webhook extends Event
{
Expand All @@ -11,8 +12,8 @@ public function __construct(protected Publisher $publisher)
parent::__construct($publisher);

$this
->setQueue(Event::WEBHOOK_QUEUE_NAME)
->setClass(Event::WEBHOOK_CLASS_NAME);
->setQueue(System::getEnv('_APP_WEBHOOK_QUEUE_NAME', Event::WEBHOOK_QUEUE_NAME))
->setClass(System::getEnv('_APP_WEBHOOK_CLASS_NAME', Event::WEBHOOK_CLASS_NAME));
}

/**
Expand Down