diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 4d002da..e98966e 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -31,5 +31,8 @@ return [ 'customfield_11692', ], ], + 'http.proxy.enabled' => false, + 'http.proxy.type' => CURLPROXY_SOCKS5, + 'http.proxy.url' => "localhost:1080", ], ]; diff --git a/config/autoload/zend-expressive.global.php b/config/autoload/zend-expressive.global.php index dd4acd1..2dbda65 100644 --- a/config/autoload/zend-expressive.global.php +++ b/config/autoload/zend-expressive.global.php @@ -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` diff --git a/src/App/ConfigProvider.php b/src/App/ConfigProvider.php index 3cea070..6ac37dd 100644 --- a/src/App/ConfigProvider.php +++ b/src/App/ConfigProvider.php @@ -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 diff --git a/src/App/Service/DataCollectorServiceFactory.php b/src/App/Service/DataCollectorServiceFactory.php index f5badac..7d1c48d 100644 --- a/src/App/Service/DataCollectorServiceFactory.php +++ b/src/App/Service/DataCollectorServiceFactory.php @@ -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); }