-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace command options/arguments with configuration file
Closes #9
- Loading branch information
1 parent
a279c09
commit f4944ef
Showing
9 changed files
with
912 additions
and
677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Application/Configurations/CertificateConfiguration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace Watchr\Application\Configurations; | ||
|
||
use Nette\Schema\Expect; | ||
use Nette\Schema\Schema; | ||
use Watchr\Application\Contracts\Configuration\ConfigurationInterface; | ||
|
||
final class CertificateConfiguration implements ConfigurationInterface { | ||
public static function getSchema(): Schema { | ||
return Expect::structure( | ||
[ | ||
'enabled' => Expect::bool(false), | ||
// expiration threshold in days, default 5 days | ||
'expirationThreshold' => Expect::int(5)->min(-1), | ||
// sha-1, hex encoded string | ||
'sha1Fingerprint' => Expect::string()->pattern('[0-9a-fA-F]{40}'), | ||
// sha-256, hex encoded string | ||
'sha256Fingerprint' => Expect::string()->pattern('[0-9a-fA-F]{64}'), | ||
// certificate serial number, hex encoded string | ||
'serialNumber' => Expect::string()->pattern('(0x)?[0-9a-fA-F]+'), | ||
'issuerName' => Expect::string(), | ||
// ocsp revocation list | ||
'ocspRevoked' => Expect::bool(false), | ||
// additional hosts (subdomains) to perform certificate check | ||
'hosts' => Expect::listOf('string') | ||
] | ||
)->required(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace Watchr\Application\Configurations; | ||
|
||
use Nette\Schema\Expect; | ||
use Nette\Schema\Schema; | ||
use Watchr\Application\Contracts\Configuration\ConfigurationInterface; | ||
|
||
final class DomainConfiguration implements ConfigurationInterface { | ||
public static function getSchema(): Schema { | ||
return Expect::structure( | ||
[ | ||
'enabled' => Expect::bool(false), | ||
// expiration threshold in days, default 5 days | ||
'expirationThreshold' => Expect::int(5)->min(-1), | ||
'registrarName' => Expect::string(), | ||
// domain status flags (eg. clientTransferProhibited) | ||
'statusFlags' => Expect::arrayOf('string') | ||
] | ||
)->required(false); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Application/Contracts/Configuration/ConfigurationInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
namespace Watchr\Application\Contracts\Configuration; | ||
|
||
use Nette\Schema\Schema; | ||
|
||
interface ConfigurationInterface { | ||
public static function getSchema(): Schema; | ||
} |
Oops, something went wrong.