mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 02:09:03 +02:00
Added possibility to enable/disable the LCSC provider
This commit is contained in:
parent
d600cb4b9a
commit
95ef97fcc2
3 changed files with 15 additions and 4 deletions
|
@ -38,7 +38,7 @@ class LCSCProvider implements InfoProviderInterface
|
|||
|
||||
public const DISTRIBUTOR_NAME = 'LCSC';
|
||||
|
||||
public function __construct(private readonly HttpClientInterface $lcscClient)
|
||||
public function __construct(private readonly HttpClientInterface $lcscClient, private bool $enabled = true)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ class LCSCProvider implements InfoProviderInterface
|
|||
{
|
||||
return [
|
||||
'name' => 'LCSC',
|
||||
'description' => 'This provider uses the LCSC API to search for parts.',
|
||||
'description' => 'This provider uses the (unofficial) LCSC API to search for parts.',
|
||||
'url' => 'https://www.lcsc.com/',
|
||||
'disabled_help' => 'This provider is enabled by default'
|
||||
'disabled_help' => 'Set PROVIDER_LCSC_ENABLED to 1 (or true) in your environment variable config.'
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ class LCSCProvider implements InfoProviderInterface
|
|||
// This provider is always active
|
||||
public function isActive(): bool
|
||||
{
|
||||
return true;
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue