Ensure consistent server and storage arguments, fix storage path for setup

This commit is contained in:
Niklas Keller
2016-03-23 20:02:25 +01:00
parent 9ea97f18e1
commit c36ced9b7c
6 changed files with 42 additions and 58 deletions

View File

@@ -69,4 +69,34 @@ function isPhar() {
function normalizePath($path) {
return rtrim(str_replace("\\", "/", $path), "/");
}
function getArgumentDescription($argument) {
$isPhar = \Kelunik\AcmeClient\isPhar();
switch ($argument) {
case "server":
return [
"prefix" => "s",
"longPrefix" => "server",
"description" => "ACME server to use for registration and issuance of certificates.",
"required" => true,
];
case "storage":
$argument = [
"longPrefix" => "storage",
"description" => "Storage directory for account keys and certificates.",
"required" => $isPhar,
];
if (!$isPhar) {
$argument["defaultValue"] = dirname(__DIR__) . "/data";
}
return $argument;
default:
throw new \InvalidArgumentException("Unknown argument: " . $argument);
}
}