30bd96d88727decc1a97de18e7eafa77396e2925
[pharext/pharext.org] / app / bootstrap / github.php
1 <?php
2
3 namespace app;
4
5 require_once __DIR__."/config.php";
6
7 use http\Url;
8
9 $injector->share(Github\API::class)
10 ->delegate(Github\API::class, function() use($injector) {
11 $config = $injector->make(Config::class);
12 if (isset($config->github->hook->use_basic_auth)) {
13 $basic = $config->github->hook->use_basic_auth;
14 $config->github->hook->url = (string) new Url(
15 $config->github->hook->url,
16 $config->$basic->auth->toArray(),
17 0);
18 }
19 // FIXME: configure through app.ini
20 return new Github\API(
21 $config->github
22 ,new Github\Logger($config)
23 ,new Github\Storage\Session("gh-tokens")
24 #,new Github\Storage\Memcache("gh-cache")
25 ,new Github\Storage\Redis("gh-cache")
26 );
27 });
28