mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Use composer/ca-bundle instead of system CA for element14 provider
This is a workaround for debian systems, where the required root CA is missing as trusted CA in the system CAs. This fixes issue #891 and #866
This commit is contained in:
parent
e75e0c4c0b
commit
49ee9131d0
3 changed files with 15 additions and 4 deletions
|
@ -15,7 +15,7 @@
|
||||||
"api-platform/core": "^3.1",
|
"api-platform/core": "^3.1",
|
||||||
"beberlei/doctrineextensions": "^1.2",
|
"beberlei/doctrineextensions": "^1.2",
|
||||||
"brick/math": "0.12.1 as 0.11.0",
|
"brick/math": "0.12.1 as 0.11.0",
|
||||||
"composer/ca-bundle": "^1.3",
|
"composer/ca-bundle": "^1.5",
|
||||||
"composer/package-versions-deprecated": "^1.11.99.5",
|
"composer/package-versions-deprecated": "^1.11.99.5",
|
||||||
"doctrine/data-fixtures": "^2.0.0",
|
"doctrine/data-fixtures": "^2.0.0",
|
||||||
"doctrine/dbal": "^4.0.0",
|
"doctrine/dbal": "^4.0.0",
|
||||||
|
|
2
composer.lock
generated
2
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "75643d42e05fce4684644d375bff2d0a",
|
"content-hash": "7fb73581b0074c5a79afb3ffa614ed8e",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "amphp/amp",
|
"name": "amphp/amp",
|
||||||
|
|
|
@ -29,6 +29,7 @@ use App\Services\InfoProviderSystem\DTOs\ParameterDTO;
|
||||||
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
||||||
use App\Services\InfoProviderSystem\DTOs\PriceDTO;
|
use App\Services\InfoProviderSystem\DTOs\PriceDTO;
|
||||||
use App\Services\InfoProviderSystem\DTOs\PurchaseInfoDTO;
|
use App\Services\InfoProviderSystem\DTOs\PurchaseInfoDTO;
|
||||||
|
use Composer\CaBundle\CaBundle;
|
||||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||||
|
|
||||||
class Element14Provider implements InfoProviderInterface
|
class Element14Provider implements InfoProviderInterface
|
||||||
|
@ -43,9 +44,19 @@ class Element14Provider implements InfoProviderInterface
|
||||||
private const COMPLIANCE_ATTRIBUTES = ['euEccn', 'hazardous', 'MSL', 'productTraceability', 'rohsCompliant',
|
private const COMPLIANCE_ATTRIBUTES = ['euEccn', 'hazardous', 'MSL', 'productTraceability', 'rohsCompliant',
|
||||||
'rohsPhthalatesCompliant', 'SVHC', 'tariffCode', 'usEccn', 'hazardCode'];
|
'rohsPhthalatesCompliant', 'SVHC', 'tariffCode', 'usEccn', 'hazardCode'];
|
||||||
|
|
||||||
public function __construct(private readonly HttpClientInterface $element14Client, private readonly string $api_key, private readonly string $store_id)
|
private readonly HttpClientInterface $element14Client;
|
||||||
{
|
|
||||||
|
|
||||||
|
public function __construct(HttpClientInterface $element14Client, private readonly string $api_key, private readonly string $store_id)
|
||||||
|
{
|
||||||
|
/* We use the mozilla CA from the composer ca bundle directly, as some debian systems seems to have problems
|
||||||
|
* with the SSL.COM CA, element14 uses. See https://github.com/Part-DB/Part-DB-server/issues/866
|
||||||
|
*
|
||||||
|
* This is a workaround until the issue is resolved in debian (or never).
|
||||||
|
* As this only affects this provider, this should have no negative impact and the CA bundle is still secure.
|
||||||
|
*/
|
||||||
|
$this->element14Client = $element14Client->withOptions([
|
||||||
|
'cafile' => CaBundle::getBundledCaBundlePath(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProviderInfo(): array
|
public function getProviderInfo(): array
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue