diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 1b93b46..ea8ef1f 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -8,4 +8,16 @@ */ return [ +'app.config' => [ + 'jira.user' => '', + 'jira.password' => '', + 'jira.query.filtered' => 'https://jirapducc.mo.ca.am.ericsson.se/rest/api/2/search?maxResults=1000&jql=filter=%s&fields=created,resolutiondate', + 'jira.query.defaultOpen' => 'https://jirapducc.mo.ca.am.ericsson.se/rest/api/2/search?maxResults=1000&jql=project = TSPCORE AND (type = "JIRA case" OR reporter in (ethfoa, edvipin, ethibi, eistkde, ejzsfek, elszhal, eptezel, ETHRGC, ETHTHS, eszigre, etibrkc, ezsubar)) AND status != Done ORDER BY created DESC&fields=created,resolutiondate', + 'jira.query.default' => 'https://jirapducc.mo.ca.am.ericsson.se/rest/api/2/search?maxResults=1000&jql=project = TSPCORE AND (type = "JIRA case" OR reporter in (ethfoa, edvipin, ethibi, eistkde, ejzsfek, elszhal, eptezel, ETHRGC, ETHTHS, eszigre, etibrkc, ezsubar)) ORDER BY created DESC&fields=created,resolutiondate', + 'jira.query.legacy' => 'https://jirapducc.mo.ca.am.ericsson.se/rest/api/2/search?jql=project = TSPCORE AND type = "JIRA case" ORDER BY created DESC&maxResults=1000&fields=created,resolutiondate', + + 'http.proxy.enabled' => false, + 'http.proxy.type' => CURLPROXY_SOCKS5, + 'http.proxy.url' => "localhost:1080", + ], ]; diff --git a/src/App/ConfigProvider.php b/src/App/ConfigProvider.php index 539581b..8e10e60 100644 --- a/src/App/ConfigProvider.php +++ b/src/App/ConfigProvider.php @@ -1,8 +1,6 @@ Action\DbgFactory::class, Service\JiraCollectorService::class => Service\JiraCollectorServiceFactory::class, - Client::class => function(ContainerInterface $container): Client { - $configArray = $container->get('config'); - $config = new Config($configArray['app.config']); - - $httpClient = new Client(); - $httpClient->setAdapter($curlAdapter = new Client\Adapter\Curl()); - $curlAdapter->setOptions([ - 'timeout' => 300, - ]); - $curlAdapter - ->setCurlOption(CURLOPT_SSL_VERIFYPEER, false) - ->setCurlOption(CURLOPT_SSL_VERIFYHOST, false) - ; - if($config->get('http.proxy.enabled', false)) { - $curlAdapter - ->setCurlOption(CURLOPT_PROXYTYPE, $config->get('http.proxy.type')) - ->setCurlOption(CURLOPT_PROXY, $config->get('http.proxy.url')) - ; - } - return $httpClient; - }, + Client::class => Service\HttpClientServiceFactory::class, ], ]; } diff --git a/src/App/Service/HttpClientServiceFactory.php b/src/App/Service/HttpClientServiceFactory.php new file mode 100644 index 0000000..000ea21 --- /dev/null +++ b/src/App/Service/HttpClientServiceFactory.php @@ -0,0 +1,33 @@ +get('config'); + $config = new Config($configArray['app.config']); + + $httpClient = new Client(); + $httpClient->setAdapter($curlAdapter = new Client\Adapter\Curl()); + $curlAdapter->setOptions([ + 'timeout' => 300, + ]); + $curlAdapter + ->setCurlOption(CURLOPT_SSL_VERIFYPEER, false) + ->setCurlOption(CURLOPT_SSL_VERIFYHOST, false) + ; + if($config->get('http.proxy.enabled', false)) { + $curlAdapter + ->setCurlOption(CURLOPT_PROXYTYPE, $config->get('http.proxy.type')) + ->setCurlOption(CURLOPT_PROXY, $config->get('http.proxy.url')) + ; + } + return $httpClient; + } +}