mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Allow to configure the reichelt info provider via env vars
This commit is contained in:
parent
90e1b809fe
commit
d13752114c
2 changed files with 20 additions and 1 deletions
12
.env
12
.env
|
@ -216,6 +216,18 @@ PROVIDER_OEMSECRETS_SET_PARAM=1
|
||||||
#If unset or set to any other value, no sorting is performed.
|
#If unset or set to any other value, no sorting is performed.
|
||||||
PROVIDER_OEMSECRETS_SORT_CRITERIA=C
|
PROVIDER_OEMSECRETS_SORT_CRITERIA=C
|
||||||
|
|
||||||
|
|
||||||
|
# Reichelt provider:
|
||||||
|
# Reichelt.com offers no official API, so this info provider webscrapes the website to extract info
|
||||||
|
# It could break at any time, use it at your own risk
|
||||||
|
|
||||||
|
# We dont require an API key for Reichelt, just set this to 1 to enable Reichelt support
|
||||||
|
PROVIDER_REICHELT_ENABLED=0
|
||||||
|
# The country to get prices for (only EUR supported for now)
|
||||||
|
PROVIDER_REICHELT_COUNTRY=DE
|
||||||
|
# The language to get results in (en, de, fr, nl, pl, it, es)
|
||||||
|
PROVIDER_REICHELT_LANGUAGE=en
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
# EDA integration related settings
|
# EDA integration related settings
|
||||||
##################################################################################
|
##################################################################################
|
||||||
|
|
|
@ -29,6 +29,7 @@ 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 App\Services\InfoProviderSystem\DTOs\SearchResultDTO;
|
use App\Services\InfoProviderSystem\DTOs\SearchResultDTO;
|
||||||
|
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||||
use Symfony\Component\DomCrawler\Crawler;
|
use Symfony\Component\DomCrawler\Crawler;
|
||||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||||
|
|
||||||
|
@ -39,7 +40,13 @@ class ReicheltProvider implements InfoProviderInterface
|
||||||
|
|
||||||
private const SEARCH_ENDPOINT = "https://www.reichelt.com/index.html?ACTION=446&LA=0&nbc=1&q=%s";
|
private const SEARCH_ENDPOINT = "https://www.reichelt.com/index.html?ACTION=446&LA=0&nbc=1&q=%s";
|
||||||
|
|
||||||
public function __construct(private readonly HttpClientInterface $client, private readonly bool $enabled = true, private readonly string $language = "en", private readonly string $country = "DE")
|
public function __construct(private readonly HttpClientInterface $client,
|
||||||
|
#[Autowire(env: "bool:PROVIDER_REICHELT_ENABLED")]
|
||||||
|
private readonly bool $enabled = true,
|
||||||
|
#[Autowire(env: "PROVIDER_REICHELT_LANGUAGE")]
|
||||||
|
private readonly string $language = "en",
|
||||||
|
#[Autowire(env: "PROVIDER_REICHELT_COUNTRY")]
|
||||||
|
private readonly string $country = "DE")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue