From 34739d9ba328b1e9176800883eae0987f5f05337 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 4 May 2015 19:44:39 +0200 Subject: [PATCH] ngrok basic auth --- app/Github/Create/Webhook.php | 1 + app/bootstrap/github.php | 11 ++++++++++- app/config.ini | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Github/Create/Webhook.php b/app/Github/Create/Webhook.php index 76765e8..6f69d0c 100644 --- a/app/Github/Create/Webhook.php +++ b/app/Github/Create/Webhook.php @@ -15,6 +15,7 @@ class Webhook extends Create "Content-Type" => "application/json", "Authorization" => "token " . $this->api->getToken(), ]); + $request->getBody()->append(json_encode([ "name" => "web", "config" => [ diff --git a/app/bootstrap/github.php b/app/bootstrap/github.php index 55a49a7..fe3477f 100644 --- a/app/bootstrap/github.php +++ b/app/bootstrap/github.php @@ -5,11 +5,20 @@ namespace app; require_once __DIR__."/config.php"; use merry\Config; +use http\Url; $injector->share(Github\API::class) ->delegate(Github\API::class, function() use($injector) { + $config = $injector->make(Config::class); + if (isset($config->github->hook->use_basic_auth)) { + $basic = $config->github->hook->use_basic_auth; + $config->github->hook->url = (string) new Url( + $config->github->hook->url, + $config->$basic->auth->toArray(), + 0); + } return new Github\API( - $injector->make(Config::class)->github + $config->github ,new Github\Storage\Session("gh-tokens") #,new Github\Storage\Memcache("gh-cache") ); diff --git a/app/config.ini b/app/config.ini index a88c395..66d0376 100644 --- a/app/config.ini +++ b/app/config.ini @@ -27,5 +27,6 @@ session.cache_expire = 0 github.hook.url = https://pharext.ngrok.io/src/pharext.org.git/public/github/hook github.hook.insecure_ssl = 1 +github.hook.use_basic_auth = ngrok ngrok.command = ngrok \ No newline at end of file -- 2.30.2