2020-07-28 19:48:51 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
global $cli;
|
|
|
|
|
|
2022-04-13 12:39:31 +00:00
|
|
|
use Appwrite\Event\Certificate;
|
2020-07-28 19:48:51 +00:00
|
|
|
use Utopia\App;
|
|
|
|
|
use Utopia\CLI\Console;
|
2022-04-13 12:39:31 +00:00
|
|
|
use Utopia\Database\Document;
|
2022-04-11 07:56:58 +00:00
|
|
|
use Utopia\Validator\Hostname;
|
2020-07-28 19:48:51 +00:00
|
|
|
|
|
|
|
|
$cli
|
|
|
|
|
->task('ssl')
|
|
|
|
|
->desc('Validate server certificates')
|
2022-04-11 07:56:58 +00: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-12 12:13:47 +00:00
|
|
|
Console::success('Scheduling a job to issue a TLS certificate for domain: ' . $domain);
|
2020-07-28 19:48:51 +00:00
|
|
|
|
2022-05-12 14:01:01 +00:00
|
|
|
(new Certificate())
|
2022-04-13 12:39:31 +00:00
|
|
|
->setDomain(new Document([
|
|
|
|
|
'domain' => $domain
|
|
|
|
|
]))
|
2022-05-11 17:04:31 +00:00
|
|
|
->setSkipRenewCheck(true)
|
2022-04-13 12:39:31 +00:00
|
|
|
->trigger();
|
|
|
|
|
});
|