1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

Changes after dev-mode QA

This commit is contained in:
Matej Bačo 2023-03-10 20:36:39 +01:00
parent 2d25514dd8
commit 541cb010a6
8 changed files with 12 additions and 21 deletions

8
.env
View file

@ -1,4 +1,4 @@
_APP_ENV=production
_APP_ENV=development
_APP_LOCALE=en
_APP_WORKER_PER_CORE=10
_APP_CONSOLE_WHITELIST_ROOT=disabled
@ -13,10 +13,10 @@ _APP_SYSTEM_RESPONSE_FORMAT=
_APP_OPTIONS_ABUSE=disabled
_APP_OPTIONS_FORCE_HTTPS=disabled
_APP_OPENSSL_KEY_V1=your-secret-key
_APP_DOMAIN=g4main.matejbaco.eu
_APP_DOMAIN_FUNCTIONS=functions.g4main.matejbaco.eu
_APP_DOMAIN=localhost
_APP_DOMAIN_FUNCTIONS=functions.localhost
_APP_DOMAIN_DO_TOKEN=
_APP_DOMAIN_TARGET=g4main.matejbaco.eu
_APP_DOMAIN_TARGET=localhost
_APP_REDIS_HOST=redis
_APP_REDIS_PORT=6379
_APP_REDIS_PASS=

View file

@ -531,8 +531,8 @@ return [
],
Exception::RULE_CONFIGURATION_MISSING => [
'name' => Exception::RULE_CONFIGURATION_MISSING,
'description' => 'Configuration for _APP_DOMAIN_TARGET missing proper domain.',
'code' => 500,
'description' => '_APP_DOMAIN_TARGET must be a public domain.',
'code' => 501,
],
Exception::RULE_RESOURCE_ID_NOT_FOUND => [
'name' => Exception::RULE_RESOURCE_ID_NOT_FOUND,

@ -1 +1 @@
Subproject commit 884a5ba74cc0b7755bcb21caedf5b1a68acdca05
Subproject commit 5cebe875f1987487bce16a7a1af0a981dbd9bad9

View file

@ -129,6 +129,7 @@ App::post('/v1/functions')
]))
);
// TODO: @Meldiron this doesnt seem to work. Same for certificate.php worker. When working, implement with Console (instead of interval)
/** Trigger Webhook */
$ruleModel = new Rule();
$ruleCreate = new Event(Event::WEBHOOK_QUEUE_NAME, Event::WEBHOOK_CLASS_NAME);

View file

@ -65,12 +65,6 @@ App::post('/v1/proxy/rules')
throw new Exception(Exception::RULE_ALREADY_EXISTS, $message);
}
$target = new Domain(App::getEnv('_APP_DOMAIN_TARGET', ''));
if (!$target->isKnown() || $target->isTest()) {
throw new Exception(Exception::RULE_CONFIGURATION_MISSING);
}
$resourceInternalId = '';
if($resourceType == 'function') {
@ -258,7 +252,7 @@ App::patch('/v1/proxy/rules/:ruleId/verification')
$target = new Domain(App::getEnv('_APP_DOMAIN_TARGET', ''));
if (!$target->isKnown() || $target->isTest()) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Unreachable CNAME target (' . $target->get() . '), please use a domain with a public suffix.');
throw new Exception(Exception::RULE_CONFIGURATION_MISSING);
}
if ($rule->getAttribute('verification') === true) {

View file

@ -55,11 +55,6 @@ function router(Database $dbForConsole, string $host, SwooleRequest $swooleReque
throw new AppwriteException(AppwriteException::ROUTER_UNKNOWN_HOST);
}
// Un-verified ignores Appwrite Router. Behaves as Appwrite API. Needed for certificate generation (well-known route)
if($route->getAttribute('status') !== 'verified') {
return false;
}
$projectId = $route->getAttribute('projectId');
$project = Authorization::skip(
fn() => $dbForConsole->getDocument('projects', $projectId)
@ -665,6 +660,7 @@ App::get('/humans.txt')
$response->text($template->render(false));
});
// TODO: @Meldiron this must run before Appwrite Router. Router makes it NOT get here. But it needs to. This must be endpoint reserved by Appwrite for certificate generation and re-generation
App::get('/.well-known/acme-challenge')
->desc('SSL Verification')
->label('scope', 'public')

View file

@ -413,7 +413,7 @@ class CertificatesV1 extends Worker
if(!$rule->isEmpty()) {
$rule->setAttribute('certificateId', $certificateId);
$rule->setAttribute('status', $success ? 'verified' : 'failed');
$rule->setAttribute('status', $success ? 'verified' : 'unverified');
$this->dbForConsole->updateDocument('rules', $rule->getId(), $rule);
$projectId = $rule->getAttribute('projectId');

View file

@ -50,7 +50,7 @@ class Rule extends Model
])
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'Domain verification status. Possible values are "created", "verifying", "verified" and "failed"',
'description' => 'Domain verification status. Possible values are "created", "verifying", "verified" and "unverified"',
'default' => false,
'example' => 'verified',
])