* debug mode on by default

* http proxy via curl adapter implemented
This commit is contained in:
Dávid Danyi 2017-07-31 16:49:50 +02:00
parent 901fb6cef0
commit f196244f7c
4 changed files with 14 additions and 6 deletions

View File

@ -31,5 +31,8 @@ return [
'customfield_11692',
],
],
'http.proxy.enabled' => false,
'http.proxy.type' => CURLPROXY_SOCKS5,
'http.proxy.url' => "localhost:1080",
],
];

View File

@ -7,10 +7,10 @@ return [
// directive, to disable configuration caching. Toggling development mode
// will also disable it by default; clear the configuration cache using
// `composer clear-config-cache`.
ConfigAggregator::ENABLE_CACHE => true,
ConfigAggregator::ENABLE_CACHE => false,
// Enable debugging; typically used to provide debugging information within templates.
'debug' => false,
'debug' => true,
'zend-expressive' => [
// Enable programmatic pipeline: Any `middleware_pipeline` or `routes`

View File

@ -3,6 +3,7 @@
namespace App;
use Interop\Container\ContainerInterface;
use Zend\Cache\Storage\Adapter\Filesystem as FilesytemCache;
use Zend\Http\Client;
/**
* The configuration provider for the App module

View File

@ -11,11 +11,15 @@ class DataCollectorServiceFactory
public function __invoke(ContainerInterface $container)
{
$configArray = $container->get('config');
$httpClient = new Client();
$httpClient->getAdapter()->setOptions([
'timeout' => 60,
]);
$config = new Config($configArray['app.config']);
$httpClient = new Client();
$httpClient->setAdapter($curlAdapter = new Client\Adapter\Curl());
$curlAdapter->setOptions(['timeout' => 60]);
if($config->get('http.proxy.enabled', false)) {
$curlAdapter
->setCurlOption(CURLOPT_PROXYTYPE, $config->get('http.proxy.type'))
->setCurlOption(CURLOPT_PROXY, $config->get('http.proxy.url'));
}
$avatarService = $container->get(AvatarService::class);
return new DataCollectorService($httpClient, $config, $avatarService);
}