2024-12-09 19:26:20 -05:00
|
|
|
<?php
|
|
|
|
|
2025-01-03 12:27:04 -05:00
|
|
|
namespace Socialbox\Classes\CliCommands;
|
2024-12-09 19:26:20 -05:00
|
|
|
|
2025-01-03 12:27:04 -05:00
|
|
|
use Socialbox\Classes\Configuration;
|
|
|
|
use Socialbox\Classes\Logger;
|
|
|
|
use Socialbox\Interfaces\CliCommandInterface;
|
2024-12-09 19:26:20 -05:00
|
|
|
|
2025-01-03 12:27:04 -05:00
|
|
|
class DnsRecordCommand implements CliCommandInterface
|
2024-12-09 19:26:20 -05:00
|
|
|
{
|
2025-01-03 12:27:04 -05:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public static function execute(array $args): int
|
|
|
|
{
|
|
|
|
$txt_record = sprintf('v=socialbox;sb-rpc=%s;sb-key=%s',
|
|
|
|
Configuration::getInstanceConfiguration()->getRpcEndpoint(),
|
|
|
|
Configuration::getCryptographyConfiguration()->getHostPublicKey()
|
|
|
|
);
|
|
|
|
|
|
|
|
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
|
2024-12-09 19:26:20 -05:00
|
|
|
Usage: socialbox dns-record
|
|
|
|
|
|
|
|
Displays the DNS TXT record that should be set for the domain.
|
|
|
|
HELP;
|
2025-01-03 12:27:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public static function getShortHelpMessage(): string
|
|
|
|
{
|
|
|
|
return 'Displays the DNS TXT record that should be set for the domain.';
|
|
|
|
}
|
|
|
|
}
|