Add DnsRecordCommand to CliCommands for DNS configuration

This commit is contained in:
netkas 2024-12-09 19:26:20 -05:00
parent 3a10e01bd8
commit 7bf5419ce3
4 changed files with 59 additions and 7 deletions

View file

@ -0,0 +1,46 @@
<?php
namespace Socialbox\Classes\CliCommands;
use Socialbox\Classes\Configuration;
use Socialbox\Classes\Logger;
use Socialbox\Interfaces\CliCommandInterface;
class DnsRecordCommand implements CliCommandInterface
{
/**
* @inheritDoc
*/
public static function execute(array $args): int
{
$txt_record = sprintf('v=socialbox;sb-rpc=%s;sb-key=%s',
Configuration::getInstanceConfiguration()->getRpcEndpoint(),
Configuration::getInstanceConfiguration()->getPublicKey()
);
Logger::getLogger()->info('Please set the following DNS TXT record for the domain:');
Logger::getLogger()->info(sprintf(' %s', $txt_record));
return 0;
}
/**
* @inheritDoc
*/
public static function getHelpMessage(): string
{
return <<<HELP
Usage: socialbox dns-record
Displays the DNS TXT record that should be set for the domain.
HELP;
}
/**
* @inheritDoc
*/
public static function getShortHelpMessage(): string
{
return 'Displays the DNS TXT record that should be set for the domain.';
}
}

View file

@ -3,7 +3,6 @@
namespace Socialbox\Classes;
use LogLib\Log;
use function Symfony\Component\String\s;
class Logger
{