diff --git a/.env b/.env index 4b292298..3b82f715 100644 --- a/.env +++ b/.env @@ -129,9 +129,6 @@ NO_URL_REWRITE_AVAILABLE=0 # Set to 1, if Part-DB should redirect all HTTP requests to HTTPS. You dont need to configure this, if your webserver already does this. REDIRECT_TO_HTTPS=0 -# If you want to use fixer.io for currency conversion, you have to set this to your API key -FIXER_API_KEY=CHANGEME - # Override value if you want to show to show a given text on homepage. # When this is empty the content of config/banner.md is used as banner BANNER="" diff --git a/config/packages/swap.yaml b/config/packages/swap.yaml index 2767f740..beb41d26 100644 --- a/config/packages/swap.yaml +++ b/config/packages/swap.yaml @@ -6,5 +6,5 @@ florianv_swap: providers: european_central_bank: ~ # European Central Bank (only works for EUR base currency) fixer: # Fixer.io (needs an API key) - access_key: "%env(FIXER_API_KEY)%" + access_key: "%env(string:default:settings:exchange_rate:fixerApiKey:INVALID)%" #exchange_rates_api: ~ \ No newline at end of file diff --git a/src/Settings/MiscSettings/ExchangeRateSettings.php b/src/Settings/MiscSettings/ExchangeRateSettings.php new file mode 100644 index 00000000..70bf15dd --- /dev/null +++ b/src/Settings/MiscSettings/ExchangeRateSettings.php @@ -0,0 +1,41 @@ +. + */ + +declare(strict_types=1); + + +namespace App\Settings\MiscSettings; + +use App\Settings\SettingsIcon; +use Jbtronics\SettingsBundle\Metadata\EnvVarMode; +use Jbtronics\SettingsBundle\Settings\Settings; +use Jbtronics\SettingsBundle\Settings\SettingsParameter; +use Symfony\Component\Translation\TranslatableMessage as TM; + +#[Settings(name: "exchange_rate", label: new TM("settings.misc.exchange_rate"))] +#[SettingsIcon("fa-money-bill-transfer")] +class ExchangeRateSettings +{ + #[SettingsParameter(label: new TM("settings.misc.exchange_rate.fixer_api_key"), + description: new TM("settings.misc.exchange_rate.fixer_api_key.help"), + envVar: "FIXER_API_KEY", envVarMode: EnvVarMode::OVERWRITE, + )] + public ?string $fixerApiKey = null; +} \ No newline at end of file diff --git a/src/Settings/MiscSettings/MiscSettings.php b/src/Settings/MiscSettings/MiscSettings.php index a2ad0fd4..b8a3a73f 100644 --- a/src/Settings/MiscSettings/MiscSettings.php +++ b/src/Settings/MiscSettings/MiscSettings.php @@ -31,4 +31,7 @@ class MiscSettings { #[EmbeddedSettings] public ?KiCadEDASettings $kicadEDA = null; + + #[EmbeddedSettings] + public ?ExchangeRateSettings $exchangeRate = null; } \ No newline at end of file diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index 56f5cb27..07d642c4 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -12976,5 +12976,23 @@ Please note, that you can not impersonate a disabled user. If you try you will g Set to false to include non-authorized offers in the results + + + settings.misc.exchange_rate + Money exchange rates + + + + + settings.misc.exchange_rate.fixer_api_key + Fixer.io API Key + + + + + settings.misc.exchange_rate.fixer_api_key.help + If you need exchange rates between non-euro currencies, you can input an API key from fixer.io here. + +