Add check to catch #30 early with a helpful message
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
/build/
|
||||
/data/
|
||||
/info/
|
||||
/vendor/
|
||||
/config.test.yml
|
||||
@@ -6,6 +6,7 @@ use Amp\CoroutineResult;
|
||||
use Amp\File\FilesystemException;
|
||||
use Amp\Process;
|
||||
use Kelunik\Acme\AcmeException;
|
||||
use Kelunik\AcmeClient\ConfigException;
|
||||
use League\CLImate\Argument\Manager;
|
||||
use League\CLImate\CLImate;
|
||||
use Symfony\Component\Yaml\Exception\ParseException;
|
||||
@@ -225,11 +226,47 @@ class Auto implements Command {
|
||||
$result = [];
|
||||
|
||||
foreach ($paths as $path => $domains) {
|
||||
if (is_numeric($path)) {
|
||||
$message = <<<MESSAGE
|
||||
Your configuration has the wrong format. Received a numeric value as path name.
|
||||
|
||||
This is most probably due to your "paths" value not being a map but a list instead.
|
||||
|
||||
If your configuration looks like this:
|
||||
|
||||
certificates:
|
||||
- paths:
|
||||
- /www/a: a.example.org
|
||||
- /www/b: b.example.org
|
||||
|
||||
Rewrite it to the following format for a single certificate:
|
||||
|
||||
certificates:
|
||||
- paths:
|
||||
/www/a: a.example.org
|
||||
/www/b: b.example.org
|
||||
|
||||
Rewrite it to the following format for two separate certificates:
|
||||
|
||||
certificates:
|
||||
- paths:
|
||||
/www/a: a.example.org
|
||||
- paths:
|
||||
/www/b: b.example.org
|
||||
|
||||
Documentation is available at https://github.com/kelunik/acme-client/blob/master/doc/usage.md#configuration
|
||||
|
||||
If this doesn't solve your issue, please reply to the following issue: https://github.com/kelunik/acme-client/issues/30
|
||||
MESSAGE;
|
||||
|
||||
throw new ConfigException($message);
|
||||
}
|
||||
|
||||
$domains = (array) $domains;
|
||||
|
||||
foreach ($domains as $domain) {
|
||||
if (isset($result[$domain])) {
|
||||
throw new \LogicException("Duplicate domain: {$domain}");
|
||||
throw new ConfigException("Duplicate domain: {$domain}");
|
||||
}
|
||||
|
||||
$result[$domain] = $path;
|
||||
|
||||
Reference in New Issue
Block a user