2020-07-29 07:48:51 +12:00
|
|
|
<?php
|
|
|
|
|
|
|
|
global $cli;
|
|
|
|
|
2022-04-14 00:39:31 +12:00
|
|
|
use Appwrite\Event\Certificate;
|
2020-07-29 07:48:51 +12:00
|
|
|
use Utopia\App;
|
|
|
|
use Utopia\CLI\Console;
|
2022-04-14 00:39:31 +12:00
|
|
|
use Utopia\Database\Document;
|
2022-04-11 19:56:58 +12:00
|
|
|
use Utopia\Validator\Hostname;
|
2020-07-29 07:48:51 +12:00
|
|
|
|
|
|
|
$cli
|
|
|
|
->task('ssl')
|
|
|
|
->desc('Validate server certificates')
|
2022-04-11 19:56:58 +12:00
|
|
|
->param('domain', App::getEnv('_APP_DOMAIN', ''), new Hostname(), 'Domain to generate certificate for. If empty, main domain will be used.', true)
|
|
|
|
->action(function ($domain) {
|
2022-05-13 00:13:47 +12:00
|
|
|
Console::success('Scheduling a job to issue a TLS certificate for domain: ' . $domain);
|
2020-07-29 07:48:51 +12:00
|
|
|
|
2022-05-13 02:01:01 +12:00
|
|
|
(new Certificate())
|
2022-04-14 00:39:31 +12:00
|
|
|
->setDomain(new Document([
|
|
|
|
'domain' => $domain
|
|
|
|
]))
|
2022-05-12 05:04:31 +12:00
|
|
|
->setSkipRenewCheck(true)
|
2022-04-14 00:39:31 +12:00
|
|
|
->trigger();
|
|
|
|
});
|