Set envVarMode to override everywhere

This commit is contained in:
Jan Böhmer 2025-07-06 22:00:46 +02:00
parent dc81a5b361
commit 423cdf6ca2
9 changed files with 80 additions and 36 deletions

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsTrait; use Jbtronics\SettingsBundle\Settings\SettingsTrait;
use Symfony\Component\Form\Extension\Core\Type\CountryType; use Symfony\Component\Form\Extension\Core\Type\CountryType;
@ -41,25 +42,29 @@ class DigikeySettings
#[SettingsParameter( #[SettingsParameter(
label: new TM("settings.ips.digikey.client_id"), label: new TM("settings.ips.digikey.client_id"),
envVar: "PROVIDER_DIGIKEY_CLIENT_ID" envVar: "PROVIDER_DIGIKEY_CLIENT_ID", envVarMode: EnvVarMode::OVERWRITE
)] )]
public ?string $clientId = null; public ?string $clientId = null;
#[SettingsParameter( #[SettingsParameter(
label: new TM("settings.ips.digikey.secret"), label: new TM("settings.ips.digikey.secret"),
envVar: "PROVIDER_DIGIKEY_SECRET" envVar: "PROVIDER_DIGIKEY_SECRET", envVarMode: EnvVarMode::OVERWRITE
)] )]
public ?string $secret = null; public ?string $secret = null;
#[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class, formOptions: ["preferred_choices" => ["EUR", "USD", "CHF", "GBP"]], envVar: "PROVIDER_DIGIKEY_CURRENCY")] #[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class,
formOptions: ["preferred_choices" => ["EUR", "USD", "CHF", "GBP"]],
envVar: "PROVIDER_DIGIKEY_CURRENCY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Currency()] #[Assert\Currency()]
public string $currency = "EUR"; public string $currency = "EUR";
#[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class, envVar: "PROVIDER_DIGIKEY_COUNTRY")] #[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class,
envVar: "PROVIDER_DIGIKEY_COUNTRY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Country] #[Assert\Country]
public string $country = "DE"; public string $country = "DE";
#[SettingsParameter(label: new TM("settings.ips.tme.language"), formType: LanguageType::class, envVar: "PROVIDER_DIGIKEY_LANGUAGE")] #[SettingsParameter(label: new TM("settings.ips.tme.language"), formType: LanguageType::class,
envVar: "PROVIDER_DIGIKEY_LANGUAGE", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Language] #[Assert\Language]
public string $language = "en"; public string $language = "en";
} }

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Jbtronics\SettingsBundle\Settings\SettingsTrait; use Jbtronics\SettingsBundle\Settings\SettingsTrait;
@ -35,9 +36,11 @@ class Element14Settings
{ {
use SettingsTrait; use SettingsTrait;
#[SettingsParameter(label: new TM("settings.ips.element14.apiKey"), description: new TM("settings.ips.element14.apiKey.help"), formOptions: ["help_html" => true], envVar: "PROVIDER_ELEMENT14_KEY")] #[SettingsParameter(label: new TM("settings.ips.element14.apiKey"), description: new TM("settings.ips.element14.apiKey.help"),
formOptions: ["help_html" => true], envVar: "PROVIDER_ELEMENT14_KEY", envVarMode: EnvVarMode::OVERWRITE)]
public ?string $apiKey = null; public ?string $apiKey = null;
#[SettingsParameter(label: new TM("settings.ips.element14.storeId"), description: new TM("settings.ips.element14.storeId.help"), formOptions: ["help_html" => true], envVar: "PROVIDER_ELEMENT14_STORE_ID")] #[SettingsParameter(label: new TM("settings.ips.element14.storeId"), description: new TM("settings.ips.element14.storeId.help"),
formOptions: ["help_html" => true], envVar: "PROVIDER_ELEMENT14_STORE_ID", envVarMode: EnvVarMode::OVERWRITE)]
public string $storeId = "de.farnell.com"; public string $storeId = "de.farnell.com";
} }

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Jbtronics\SettingsBundle\Settings\SettingsTrait; use Jbtronics\SettingsBundle\Settings\SettingsTrait;
@ -37,10 +38,12 @@ class LCSCSettings
{ {
use SettingsTrait; use SettingsTrait;
#[SettingsParameter(label: new TM("settings.ips.lcsc.enabled"), envVar: "bool:PROVIDER_LCSC_ENABLED")] #[SettingsParameter(label: new TM("settings.ips.lcsc.enabled"),
envVar: "bool:PROVIDER_LCSC_ENABLED", envVarMode: EnvVarMode::OVERWRITE)]
public bool $enabled = false; public bool $enabled = false;
#[SettingsParameter(label: new TM("settings.ips.lcsc.currency"), formType: CurrencyType::class, envVar: "string:PROVIDER_LCSC_CURRENCY")] #[SettingsParameter(label: new TM("settings.ips.lcsc.currency"), formType: CurrencyType::class,
envVar: "string:PROVIDER_LCSC_CURRENCY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Currency()] #[Assert\Currency()]
public string $currency = 'EUR'; public string $currency = 'EUR';
} }

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
@ -33,22 +34,25 @@ use Symfony\Component\Translation\TranslatableMessage as TM;
#[SettingsIcon("fa-plug")] #[SettingsIcon("fa-plug")]
class MouserSettings class MouserSettings
{ {
#[SettingsParameter(label: new TM("settings.ips.mouser.apiKey"), description: new TM("settings.ips.mouser.apiKey.help"), formOptions: ["help_html" => true], envVar: "PROVIDER_MOUSER_KEY")] #[SettingsParameter(label: new TM("settings.ips.mouser.apiKey"), description: new TM("settings.ips.mouser.apiKey.help"),
formOptions: ["help_html" => true], envVar: "PROVIDER_MOUSER_KEY", envVarMode: EnvVarMode::OVERWRITE)]
public ?string $apiKey = null; public ?string $apiKey = null;
/** @var int The number of results to get from Mouser while searching (please note that this value is max 50) */ /** @var int The number of results to get from Mouser while searching (please note that this value is max 50) */
#[SettingsParameter(label: new TM("settings.ips.mouser.searchLimit"), description: new TM("settings.ips.mouser.searchLimit.help"), envVar: "int:PROVIDER_MOUSER_SEARCH_LIMIT")] #[SettingsParameter(label: new TM("settings.ips.mouser.searchLimit"), description: new TM("settings.ips.mouser.searchLimit.help"),
envVar: "int:PROVIDER_MOUSER_SEARCH_LIMIT", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Range(min: 1, max: 50)] #[Assert\Range(min: 1, max: 50)]
public int $searchLimit = 50; public int $searchLimit = 50;
/** @var MouserSearchOptions Filter search results by RoHS compliance and stock availability */ /** @var MouserSearchOptions Filter search results by RoHS compliance and stock availability */
#[SettingsParameter(label: new TM("settings.ips.mouser.searchOptions"), description: new TM("settings.ips.mouser.searchOptions.help"), envVar: "PROVIDER_MOUSER_SEARCH_OPTION", envVarMapper: [self::class, "mapSearchOptionEnvVar"])] #[SettingsParameter(label: new TM("settings.ips.mouser.searchOptions"), description: new TM("settings.ips.mouser.searchOptions.help"),
envVar: "PROVIDER_MOUSER_SEARCH_OPTION", envVarMode: EnvVarMode::OVERWRITE, envVarMapper: [self::class, "mapSearchOptionEnvVar"])]
public MouserSearchOptions $searchOption = MouserSearchOptions::NONE; public MouserSearchOptions $searchOption = MouserSearchOptions::NONE;
/** @var bool It is recommended to leave this set to 'true'. The option is not really documented by Mouser: /** @var bool It is recommended to leave this set to 'true'. The option is not really documented by Mouser:
* Used when searching for keywords in the language specified when you signed up for Search API. */ * Used when searching for keywords in the language specified when you signed up for Search API. */
//TODO: Put this into some expert mode only //TODO: Put this into some expert mode only
#[SettingsParameter(envVar: "bool:PROVIDER_MOUSER_SEARCH_WITH_SIGNUP_LANGUAGE")] //#[SettingsParameter(envVar: "bool:PROVIDER_MOUSER_SEARCH_WITH_SIGNUP_LANGUAGE")]
public bool $searchWithSignUpLanguage = true; public bool $searchWithSignUpLanguage = true;
public static function mapSearchOptionEnvVar(?string $value): MouserSearchOptions public static function mapSearchOptionEnvVar(?string $value): MouserSearchOptions

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Jbtronics\SettingsBundle\Settings\SettingsTrait; use Jbtronics\SettingsBundle\Settings\SettingsTrait;
@ -41,14 +42,17 @@ class OEMSecretsSettings
public const SUPPORTED_CURRENCIES = ["AUD", "CAD", "CHF", "CNY", "DKK", "EUR", "GBP", "HKD", "ILS", "INR", "JPY", "KRW", "NOK", public const SUPPORTED_CURRENCIES = ["AUD", "CAD", "CHF", "CNY", "DKK", "EUR", "GBP", "HKD", "ILS", "INR", "JPY", "KRW", "NOK",
"NZD", "RUB", "SEK", "SGD", "TWD", "USD"]; "NZD", "RUB", "SEK", "SGD", "TWD", "USD"];
#[SettingsParameter(label: new TM("settings.ips.element14.apiKey"), envVar: "PROVIDER_OEMSECRETS_KEY")] #[SettingsParameter(label: new TM("settings.ips.element14.apiKey"),
envVar: "PROVIDER_OEMSECRETS_KEY", envVarMode: EnvVarMode::OVERWRITE)]
public ?string $apiKey = null; public ?string $apiKey = null;
#[Assert\Country] #[Assert\Country]
#[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class, formOptions: ["preferred_choices" => ["DE", "PL", "GB", "FR", "US"]], envVar: "PROVIDER_OEMSECRETS_COUNTRY_CODE")] #[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class, formOptions: ["preferred_choices" => ["DE", "PL", "GB", "FR", "US"]],
envVar: "PROVIDER_OEMSECRETS_COUNTRY_CODE", envVarMode: EnvVarMode::OVERWRITE)]
public ?string $country = "DE"; public ?string $country = "DE";
#[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class, formOptions: ["preferred_choices" => self::SUPPORTED_CURRENCIES], envVar: "PROVIDER_OEMSECRETS_CURRENCY")] #[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class, formOptions: ["preferred_choices" => self::SUPPORTED_CURRENCIES],
envVar: "PROVIDER_OEMSECRETS_CURRENCY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Choice(choices: self::SUPPORTED_CURRENCIES)] #[Assert\Choice(choices: self::SUPPORTED_CURRENCIES)]
public string $currency = "EUR"; public string $currency = "EUR";
@ -56,7 +60,8 @@ class OEMSecretsSettings
* @var bool If this is enabled, distributors with zero prices * @var bool If this is enabled, distributors with zero prices
* will be discarded from the creation of a new part * will be discarded from the creation of a new part
*/ */
#[SettingsParameter(label: new TM("settings.ips.oemsecrets.keepZeroPrices"), description: new TM("settings.ips.oemsecrets.keepZeroPrices.help"), envVar: "bool:PROVIDER_OEMSECRETS_ZERO_PRICE")] #[SettingsParameter(label: new TM("settings.ips.oemsecrets.keepZeroPrices"), description: new TM("settings.ips.oemsecrets.keepZeroPrices.help"),
envVar: "bool:PROVIDER_OEMSECRETS_ZERO_PRICE", envVarMode: EnvVarMode::OVERWRITE)]
public bool $keepZeroPrices = false; public bool $keepZeroPrices = false;
/** /**
@ -64,7 +69,8 @@ class OEMSecretsSettings
* # from the description transforming unstructured descriptions into structured parameters; * # from the description transforming unstructured descriptions into structured parameters;
* # each parameter in description should have the form: "...;name1:value1;name2:value2" * # each parameter in description should have the form: "...;name1:value1;name2:value2"
*/ */
#[SettingsParameter(label: new TM("settings.ips.oemsecrets.parseParams"), description: new TM("settings.ips.oemsecrets.parseParams.help"), envVar: "bool:PROVIDER_OEMSECRETS_SET_PARAM")] #[SettingsParameter(label: new TM("settings.ips.oemsecrets.parseParams"), description: new TM("settings.ips.oemsecrets.parseParams.help"),
envVar: "bool:PROVIDER_OEMSECRETS_SET_PARAM", envVarMode: EnvVarMode::OVERWRITE)]
public bool $parseParams = true; public bool $parseParams = true;
#[SettingsParameter(label: new TM("settings.ips.oemsecrets.sortMode"), envVar: "PROVIDER_OEMSECRETS_SORT_CRITERIA", envVarMapper: [self::class, "mapSortModeEnvVar"])] #[SettingsParameter(label: new TM("settings.ips.oemsecrets.sortMode"), envVar: "PROVIDER_OEMSECRETS_SORT_CRITERIA", envVarMapper: [self::class, "mapSortModeEnvVar"])]

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Jbtronics\SettingsBundle\Settings\SettingsTrait; use Jbtronics\SettingsBundle\Settings\SettingsTrait;
@ -41,30 +42,37 @@ class OctopartSettings
#[SettingsParameter( #[SettingsParameter(
label: new TM("settings.ips.digikey.client_id"), label: new TM("settings.ips.digikey.client_id"),
envVar: "PROVIDER_OCTOPART_CLIENT_ID" envVar: "PROVIDER_OCTOPART_CLIENT_ID", envVarMode: EnvVarMode::OVERWRITE
)] )]
public ?string $clientId = null; public ?string $clientId = null;
#[SettingsParameter( #[SettingsParameter(
label: new TM("settings.ips.digikey.secret"), label: new TM("settings.ips.digikey.secret"),
envVar: "PROVIDER_OCTOPART_SECRET" envVar: "PROVIDER_OCTOPART_SECRET", envVarMode: EnvVarMode::OVERWRITE
)] )]
public ?string $secret = null; public ?string $secret = null;
#[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class, formOptions: ["preferred_choices" => ["EUR", "USD", "CHF", "GBP"]], envVar: "PROVIDER_OCTOPART_CURRENCY")] #[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class,
formOptions: ["preferred_choices" => ["EUR", "USD", "CHF", "GBP"]],
envVar: "PROVIDER_OCTOPART_CURRENCY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Currency()] #[Assert\Currency()]
public string $currency = "EUR"; public string $currency = "EUR";
#[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class, envVar: "PROVIDER_OCTOPART_COUNTRY")] #[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class,
envVar: "PROVIDER_OCTOPART_COUNTRY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Country] #[Assert\Country]
public string $country = "DE"; public string $country = "DE";
#[SettingsParameter(label: new TM("settings.ips.octopart.searchLimit"), description: new TM("settings.ips.octopart.searchLimit.help"), #[SettingsParameter(label: new TM("settings.ips.octopart.searchLimit"), description: new TM("settings.ips.octopart.searchLimit.help"),
formType: NumberType::class, formOptions: ["attr" => ["min" => 1, "max" => 100]], envVar: "PROVIDER_OCTOPART_SEARCH_LIMIT")] formType: NumberType::class, formOptions: ["attr" => ["min" => 1, "max" => 100]],
envVar: "int:PROVIDER_OCTOPART_SEARCH_LIMIT", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Range(min: 1, max: 100)] #[Assert\Range(min: 1, max: 100)]
public int $searchLimit = 10; public int $searchLimit = 10;
#[SettingsParameter(label: new TM("settings.ips.octopart.onlyAuthorizedSellers"), description: new TM("settings.ips.octopart.onlyAuthorizedSellers.help"))] #[SettingsParameter(label: new TM("settings.ips.octopart.onlyAuthorizedSellers"),
description: new TM("settings.ips.octopart.onlyAuthorizedSellers.help"),
envVar: "bool:PROVIDER_OCTOPART_ONLY_AUTHORIZED_SELLERS", envVarMode: EnvVarMode::OVERWRITE
)]
public bool $onlyAuthorizedSellers = true; public bool $onlyAuthorizedSellers = true;
} }

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Symfony\Component\Translation\TranslatableMessage as TM; use Symfony\Component\Translation\TranslatableMessage as TM;
@ -32,6 +33,7 @@ use Symfony\Component\Translation\TranslatableMessage as TM;
#[SettingsIcon("fa-plug")] #[SettingsIcon("fa-plug")]
class PollinSettings class PollinSettings
{ {
#[SettingsParameter(label: new TM("settings.ips.lcsc.enabled"), envVar: "bool:PROVIDER_POLLIN_ENABLED")] #[SettingsParameter(label: new TM("settings.ips.lcsc.enabled"),
envVar: "bool:PROVIDER_POLLIN_ENABLED", envVarMode: EnvVarMode::OVERWRITE)]
public bool $enabled = false; public bool $enabled = false;
} }

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Jbtronics\SettingsBundle\Settings\SettingsTrait; use Jbtronics\SettingsBundle\Settings\SettingsTrait;
@ -41,22 +42,27 @@ class ReicheltSettings
public const SUPPORTED_LANGUAGE = ["en", "de", "fr", "nl", "pl", "it", "es"]; public const SUPPORTED_LANGUAGE = ["en", "de", "fr", "nl", "pl", "it", "es"];
#[SettingsParameter(label: new TM("settings.ips.lcsc.enabled"), envVar: "bool:PROVIDER_REICHELT_ENABLED")] #[SettingsParameter(label: new TM("settings.ips.lcsc.enabled"),
envVar: "bool:PROVIDER_REICHELT_ENABLED", envVarMode: EnvVarMode::OVERWRITE)]
public bool $enabled = false; public bool $enabled = false;
#[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class, formOptions: ["preferred_choices" => ["EUR"]], envVar: "PROVIDER_REICHELT_CURRENCY")] #[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class, formOptions: ["preferred_choices" => ["EUR"]],
envVar: "PROVIDER_REICHELT_CURRENCY", envVarMode: EnvVarMode::OVERWRITE)]
public string $currency = "EUR"; public string $currency = "EUR";
#[SettingsParameter(label: new TM("settings.ips.tme.language"), formType: LanguageType::class, formOptions: ["preferred_choices" => self::SUPPORTED_LANGUAGE], envVar: "PROVIDER_REICHELT_LANGUAGE")] #[SettingsParameter(label: new TM("settings.ips.tme.language"), formType: LanguageType::class, formOptions: ["preferred_choices" => self::SUPPORTED_LANGUAGE],
envVar: "PROVIDER_REICHELT_LANGUAGE", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Language()] #[Assert\Language()]
#[Assert\Choice(choices: self::SUPPORTED_LANGUAGE)] #[Assert\Choice(choices: self::SUPPORTED_LANGUAGE)]
public string $language = "en"; public string $language = "en";
#[SettingsParameter(label: new TM("settings.ips.tme.country"), envVar: "PROVIDER_REICHELT_COUNTRY", formType: CountryType::class, formOptions: ["preferred_choices" => ["DE", "PL", "GB", "FR"]])] #[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class, formOptions: ["preferred_choices" => ["DE", "PL", "GB", "FR"]],
envVar: "PROVIDER_REICHELT_COUNTRY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Country] #[Assert\Country]
public string $country = "DE"; public string $country = "DE";
#[SettingsParameter(label: new TM("settings.ips.reichelt.include_vat"), envVar: "bool:PROVIDER_REICHELT_INCLUDE_VAT")] #[SettingsParameter(label: new TM("settings.ips.reichelt.include_vat"),
envVar: "bool:PROVIDER_REICHELT_INCLUDE_VAT", envVarMode: EnvVarMode::OVERWRITE)]
public bool $includeVAT = true; public bool $includeVAT = true;
} }

View file

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem; namespace App\Settings\InfoProviderSystem;
use App\Settings\SettingsIcon; use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings; use Jbtronics\SettingsBundle\Settings\Settings;
use Jbtronics\SettingsBundle\Settings\SettingsParameter; use Jbtronics\SettingsBundle\Settings\SettingsParameter;
use Jbtronics\SettingsBundle\Settings\SettingsTrait; use Jbtronics\SettingsBundle\Settings\SettingsTrait;
@ -42,24 +43,30 @@ class TMESettings
private const SUPPORTED_CURRENCIES = ["EUR", "USD", "PLN", "GBP"]; private const SUPPORTED_CURRENCIES = ["EUR", "USD", "PLN", "GBP"];
#[SettingsParameter(label: new TM("settings.ips.tme.token"), #[SettingsParameter(label: new TM("settings.ips.tme.token"),
description: new TM("settings.ips.tme.token.help"), formOptions: ["help_html" => true], envVar: "PROVIDER_TME_KEY")] description: new TM("settings.ips.tme.token.help"), formOptions: ["help_html" => true],
envVar: "PROVIDER_TME_KEY", envVarMode: EnvVarMode::OVERWRITE)]
public ?string $apiToken = null; public ?string $apiToken = null;
#[SettingsParameter(label: new TM("settings.ips.tme.secret"), envVar: "PROVIDER_TME_SECRET")] #[SettingsParameter(label: new TM("settings.ips.tme.secret"),
envVar: "PROVIDER_TME_SECRET", envVarMode: EnvVarMode::OVERWRITE)]
public ?string $apiSecret = null; public ?string $apiSecret = null;
#[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class, formOptions: ["preferred_choices" => self::SUPPORTED_CURRENCIES], envVar: "PROVIDER_TME_CURRENCY")] #[SettingsParameter(label: new TM("settings.ips.tme.currency"), formType: CurrencyType::class, formOptions: ["preferred_choices" => self::SUPPORTED_CURRENCIES],
envVar: "PROVIDER_TME_CURRENCY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Choice(choices: self::SUPPORTED_CURRENCIES)] #[Assert\Choice(choices: self::SUPPORTED_CURRENCIES)]
public string $currency = "EUR"; public string $currency = "EUR";
#[SettingsParameter(label: new TM("settings.ips.tme.language"), formType: LanguageType::class, formOptions: ["preferred_choices" => ["en", "de", "fr", "pl"]], envVar: "PROVIDER_TME_LANGUAGE")] #[SettingsParameter(label: new TM("settings.ips.tme.language"), formType: LanguageType::class, formOptions: ["preferred_choices" => ["en", "de", "fr", "pl"]],
envVar: "PROVIDER_TME_LANGUAGE", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Language] #[Assert\Language]
public string $language = "en"; public string $language = "en";
#[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class, formOptions: ["preferred_choices" => ["DE", "PL", "GB", "FR"]], envVar: "PROVIDER_TME_COUNTRY")] #[SettingsParameter(label: new TM("settings.ips.tme.country"), formType: CountryType::class, formOptions: ["preferred_choices" => ["DE", "PL", "GB", "FR"]],
envVar: "PROVIDER_TME_COUNTRY", envVarMode: EnvVarMode::OVERWRITE)]
#[Assert\Country] #[Assert\Country]
public string $country = "DE"; public string $country = "DE";
#[SettingsParameter(label: new TM("settings.ips.tme.grossPrices"), envVar: "bool:PROVIDER_TME_GET_GROSS_PRICES")] #[SettingsParameter(label: new TM("settings.ips.tme.grossPrices"),
envVar: "bool:PROVIDER_TME_GET_GROSS_PRICES", envVarMode: EnvVarMode::OVERWRITE)]
public bool $grossPrices = true; public bool $grossPrices = true;
} }