diff --git a/README.md b/README.md index 5caf3f8..222450a 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,13 @@ To automatically renew your certificate add the Certbot renew command in a cron ## Docker There is also a docker container which you can use. You can either bind mount the `config` and / or `logs` folder or use -`ENV` variables. +`ENV` variables. The application runs in the `/opt/certbot-dns-transip` directory. -```shell +```shell script docker run -ti \ --v "${PWD}/letsencrypt:/etc/letsencrypt" \ --v "${PWD}/config:/opt/certbot-dns-transip/config" \ --v "${PWD}/logs:/opt/certbot-dns-transip/logs" \ +--mount type=bind,source="${PWD}"/letsencrypt,target="/etc/letsencrypt" \ +--mount type=bind,source="${PWD}"/config,target="/opt/certbot-dns-transip/config" \ +--mount type=bind,source="${PWD}"/logs,target="/opt/certbot-dns-transip/logs" \ rbongers/certbot-dns-transip \ certonly --manual --preferred-challenge=dns \ --manual-auth-hook=/opt/certbot-dns-transip/auth-hook \ @@ -68,11 +68,11 @@ certonly --manual --preferred-challenge=dns \ ``` And to renew certificates: -```shell +```shell script docker run -ti \ --v "${PWD}/letsencrypt:/etc/letsencrypt" \ --v "${PWD}/config:/opt/certbot-dns-transip/config" \ --v "${PWD}/logs:/opt/certbot-dns-transip/logs" \ +--mount type=bind,source="${PWD}"/letsencrypt,target="/etc/letsencrypt" \ +--mount type=bind,source="${PWD}"/config,target="/opt/certbot-dns-transip/config" \ +--mount type=bind,source="${PWD}"/logs,target="/opt/certbot-dns-transip/logs" \ rbongers/certbot-dns-transip \ renew ``` diff --git a/src/CertbotTransIpDns01/Bootstrap.php b/src/CertbotTransIpDns01/Bootstrap.php index 4ef0e71..6ef446f 100644 --- a/src/CertbotTransIpDns01/Bootstrap.php +++ b/src/CertbotTransIpDns01/Bootstrap.php @@ -33,9 +33,9 @@ class Bootstrap implements LoggerAwareInterface public function __construct(HookRequestInterface $request) { - try { - $this->setUp(); + $this->setUp(); + try { if ($request instanceof AuthHookRequest) { $this->acme2->authHook($request); } elseif ($request instanceof CleanupHookRequest) { diff --git a/src/CertbotTransIpDns01/ConfigLoader.php b/src/CertbotTransIpDns01/ConfigLoader.php index 954238a..a83f680 100644 --- a/src/CertbotTransIpDns01/ConfigLoader.php +++ b/src/CertbotTransIpDns01/ConfigLoader.php @@ -25,9 +25,10 @@ public function __construct() $this->config = include(APP_ROOT . '/config/transip.php'); } - foreach ($this->requires as $required) { - if ($this->get($required) === null) { - throw new RuntimeException(sprintf("Config option '%s' not found", $required)); + foreach ($this->requires as $requiredConfigKey) { + $requiredConfigKeyWithProvider = $this->get('provider') . '_' . $requiredConfigKey; + if ($this->get($requiredConfigKeyWithProvider, $this->get($requiredConfigKey)) === null) { + throw new RuntimeException(sprintf("Config option '%s' not found", $requiredConfigKey)); } } }