feat: update proxy and certificates files

This commit is contained in:
Christy Jacob
2024-11-28 14:18:37 +04:00
parent 7e98493324
commit 48d20b2c67
3 changed files with 8 additions and 9 deletions
+1 -1
View File
@@ -329,7 +329,7 @@ App::post('/v1/functions')
$routeSubdomain = ID::unique();
$domain = "{$routeSubdomain}.{$functionsDomain}";
// TODO: @christyjacob remove once we migrate the rules in 1.7.x
$ruleId = version_compare(APP_VERSION_STABLE, '1.7.0', '<') ? ID::unique() : md5($domain);
$ruleId = System::getEnv('_APP_RULES_FORMAT', null) === 'md5' ? md5($domain) : ID::unique();
$rule = Authorization::skip(
fn () => $dbForConsole->createDocument('rules', new Document([
+4 -5
View File
@@ -61,13 +61,12 @@ App::post('/v1/proxy/rules')
}
// TODO: @christyjacob remove once we migrate the rules in 1.7.x
if (version_compare(APP_VERSION_STABLE, '1.7.0', '<')) {
if (System::getEnv('_APP_RULES_FORMAT', null) === 'md5') {
$document = $dbForConsole->getDocument('rules', md5($domain));
} else {
$document = $dbForConsole->findOne('rules', [
Query::equal('domain', [$domain]),
]);
} else {
$ruleId = md5($domain);
$document = $dbForConsole->getDocument('rules', $ruleId);
}
@@ -111,7 +110,7 @@ App::post('/v1/proxy/rules')
}
// TODO: @christyjacob remove once we migrate the rules in 1.7.x
$ruleId = version_compare(APP_VERSION_STABLE, '1.7.0', '<') ? ID::unique() : md5($domain->get());
$ruleId = System::getEnv('_APP_RULES_FORMAT', null) === 'md5' ? md5($domain->get()) : ID::unique();
$rule = new Document([
'$id' => $ruleId,
@@ -340,12 +340,12 @@ class Certificates extends Action
private function updateDomainDocuments(string $certificateId, string $domain, bool $success, Database $dbForConsole, Event $queueForEvents, Func $queueForFunctions): void
{
// TODO: @christyjacob remove once we migrate the rules in 1.7.x
if (version_compare(APP_VERSION_STABLE, '1.7.0', '<')) {
if (System::getEnv('_APP_RULES_FORMAT', null) === 'md5') {
$rule = $dbForConsole->getDocument('rules', md5($domain));
} else {
$rule = $dbForConsole->findOne('rules', [
Query::equal('domain', [$domain]),
]);
} else {
$rule = $dbForConsole->getDocument('rules', md5($domain));
}
if (!$rule->isEmpty()) {