ngrok basic auth
authorMichael Wallner <mike@php.net>
Mon, 4 May 2015 17:44:39 +0000 (19:44 +0200)
committerMichael Wallner <mike@php.net>
Mon, 4 May 2015 17:44:39 +0000 (19:44 +0200)
app/Github/Create/Webhook.php
app/bootstrap/github.php
app/config.ini

index 76765e89344a0475c7bbb0137794b3fd54244123..6f69d0c811ad2fe7ea73fac197b2ac55f0a98391 100644 (file)
@@ -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" => [
index 55a49a7298034c614976be6340a4df296d7f0f6c..fe3477f4d027ea6c607e9fdd150fc50d18ea2bcd 100644 (file)
@@ -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")
           );
index a88c3955b35b5ccc9aecc30fdf010655367cd187..66d03766300f792d41216cc5e38271d4f0ac8bc0 100644 (file)
@@ -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