Add DnsRecordCommand to CliCommands for DNS configuration
This commit is contained in:
parent
3a10e01bd8
commit
7bf5419ce3
4 changed files with 59 additions and 7 deletions
46
src/Socialbox/Classes/CliCommands/DnsRecordCommand.php
Normal file
46
src/Socialbox/Classes/CliCommands/DnsRecordCommand.php
Normal 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.';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue