From d41921befb7abcf5e928aa3394fba3c2863cc5f4 Mon Sep 17 00:00:00 2001 From: shimon Date: Mon, 17 Feb 2025 16:13:48 +0200 Subject: [PATCH] add region column to rules collection --- app/config/collections/platform.php | 20 +++++++++++++++++++- app/controllers/api/functions.php | 1 + app/controllers/api/proxy.php | 1 + app/controllers/general.php | 3 ++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/config/collections/platform.php b/app/config/collections/platform.php index a5fedb6461..8d996f7178 100644 --- a/app/config/collections/platform.php +++ b/app/config/collections/platform.php @@ -1066,7 +1066,18 @@ return [ 'default' => null, 'array' => false, 'filters' => [], - ] + ], + [ + '$id' => ID::custom('region'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], ], 'indexes' => [ [ @@ -1111,6 +1122,13 @@ return [ 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], + [ + '$id' => ID::custom('_key_domain_region'), + 'type' => Database::INDEX_UNIQUE, + 'attributes' => ['domain', 'region'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], ], ], diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 14255ef7a4..f325f5925b 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -383,6 +383,7 @@ App::post('/v1/functions') 'resourceInternalId' => $function->getInternalId(), 'status' => 'verified', 'certificateId' => '', + 'region' => $project->getAttribute('region') ])) ); diff --git a/app/controllers/api/proxy.php b/app/controllers/api/proxy.php index 2567c23be6..e7fc895ffd 100644 --- a/app/controllers/api/proxy.php +++ b/app/controllers/api/proxy.php @@ -130,6 +130,7 @@ App::post('/v1/proxy/rules') 'resourceId' => $resourceId, 'resourceInternalId' => $resourceInternalId, 'certificateId' => '', + 'region' => $project->getAttribute('region') ]); $status = 'created'; diff --git a/app/controllers/general.php b/app/controllers/general.php index b785f0dde9..1835f9c917 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -590,7 +590,8 @@ App::init() 'resourceType' => 'api', 'status' => 'verifying', 'projectId' => 'console', - 'projectInternalId' => 'console' + 'projectInternalId' => 'console', + 'region' => System::getEnv('_APP_REGION', 'default'), ]); $domainDocument = $dbForPlatform->createDocument('rules', $domainDocument);