Skip to content

Commit

Permalink
Start using depency injection
Browse files Browse the repository at this point in the history
  • Loading branch information
roy-bongers committed Feb 16, 2020
1 parent c52dd90 commit 41a6390
Show file tree
Hide file tree
Showing 22 changed files with 576 additions and 226 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config/transip.php
config/config.php
vendor/
logs/*
!logs/.gitkeep
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Upgrading? See the [upgrade guide](#upgrade-guide).

## Installation
* Run `composer install --no-dev`
* Copy `config/transip.php.example` to `config/transip.php`
* Copy `config/config.php.example` to `config/config.php`
* Acquire an API key for TransIP in [your account][4] on their website
* Edit `config/transip.php` and set your login and private key.
* Edit `config/config.php` and set your login and private key.
* Make sure you set the access to this file to only allow your user to read the contents of this file (on linux
`chmod og-rwx config/transip.php`)
`chmod og-rwx config/config.php`)

## Request a wildcard certificate

Expand All @@ -52,7 +52,7 @@ There is also a docker container which you can use. You can either bind mount th
These variables are available: `TRANSIP_LOGIN`, `TRANSIP_PRIVATE_KEY`, `LOGLEVEL`, `LOGFILE`.
Only the first two variables are required.

For information about values see `config/transip.php.example`. Multiline values (the private key) can be a bit harder
For information about values see `config/config.php.example`. Multiline values (the private key) can be a bit harder
to set. Make sure the entire private key is stored in the `TRANSIP_PRIVATE_KEY` variable!

The application runs in the `/opt/certbot-dns-transip` directory and the certificates are created in `/etc/letsencrypt`.
Expand Down Expand Up @@ -87,7 +87,7 @@ It probably works fine on other systems and versions of PHP but no guarantees ar
Version 2.0 is a complete rewrite of the code base and breaks with the original version. Follow these steps to upgrade:
1. Checkout the latest master branch
1. Follow the [installation guide](#installation)
1. Remove the `Transip` folder after copying your login and private key to `config/transip.php`
1. Remove the `Transip` folder after copying your login and private key to `config/config.php`
1. You are ready to go!

## Contributors
Expand Down
8 changes: 5 additions & 3 deletions auth-hook
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ declare(strict_types = 1);

define('APP_ROOT', __DIR__);
require_once(APP_ROOT.'/vendor/autoload.php');
require_once(APP_ROOT . '/src/app.php');

use RoyBongers\CertbotTransIpDns01\Bootstrap;
use RoyBongers\CertbotTransIpDns01\Certbot\Requests\AuthHookRequest;
use RoyBongers\CertbotDns01\Certbot\Dns01ManualHookHandler;
use RoyBongers\CertbotDns01\Certbot\Requests\ManualHookRequest;

(new Bootstrap(new AuthHookRequest()));
$hookHandler = $container->get(Dns01ManualHookHandler::class);
$hookHandler->authHook(new ManualHookRequest());
8 changes: 5 additions & 3 deletions cleanup-hook
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ declare(strict_types = 1);

define('APP_ROOT', __DIR__);
require_once(APP_ROOT.'/vendor/autoload.php');
require_once(APP_ROOT . '/src/app.php');

use RoyBongers\CertbotTransIpDns01\Bootstrap;
use RoyBongers\CertbotTransIpDns01\Certbot\Requests\CleanupHookRequest;
use RoyBongers\CertbotDns01\Certbot\Dns01ManualHookHandler;
use RoyBongers\CertbotDns01\Certbot\Requests\ManualHookRequest;

(new Bootstrap(new CleanupHookRequest()));
$hookHandler = $container->get(Dns01ManualHookHandler::class);
$hookHandler->cleanupHook(new ManualHookRequest());
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"ext-xml": "*",
"transip/transip-api-php": "^5.16",
"monolog/monolog": "^2.0",
"purplepixie/phpdns": "^2.0"
"purplepixie/phpdns": "^2.0",
"php-di/php-di": "^6.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "3.5.4",
Expand Down
Loading

0 comments on commit 41a6390

Please sign in to comment.