Skip to content

Commit a4f2a7a

Browse files
committed
Moved fixer API config to settings bundle
1 parent c0c847c commit a4f2a7a

File tree

5 files changed

+63
-4
lines changed

5 files changed

+63
-4
lines changed

.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ NO_URL_REWRITE_AVAILABLE=0
129129
# 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.
130130
REDIRECT_TO_HTTPS=0
131131

132-
# If you want to use fixer.io for currency conversion, you have to set this to your API key
133-
FIXER_API_KEY=CHANGEME
134-
135132
# Override value if you want to show to show a given text on homepage.
136133
# When this is empty the content of config/banner.md is used as banner
137134
BANNER=""

config/packages/swap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ florianv_swap:
66
providers:
77
european_central_bank: ~ # European Central Bank (only works for EUR base currency)
88
fixer: # Fixer.io (needs an API key)
9-
access_key: "%env(FIXER_API_KEY)%"
9+
access_key: "%env(string:default:settings:exchange_rate:fixerApiKey:INVALID)%"
1010
#exchange_rates_api: ~
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/*
3+
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
4+
*
5+
* Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics)
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU Affero General Public License as published
9+
* by the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU Affero General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Affero General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
declare(strict_types=1);
22+
23+
24+
namespace App\Settings\MiscSettings;
25+
26+
use App\Settings\SettingsIcon;
27+
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
28+
use Jbtronics\SettingsBundle\Settings\Settings;
29+
use Jbtronics\SettingsBundle\Settings\SettingsParameter;
30+
use Symfony\Component\Translation\TranslatableMessage as TM;
31+
32+
#[Settings(name: "exchange_rate", label: new TM("settings.misc.exchange_rate"))]
33+
#[SettingsIcon("fa-money-bill-transfer")]
34+
class ExchangeRateSettings
35+
{
36+
#[SettingsParameter(label: new TM("settings.misc.exchange_rate.fixer_api_key"),
37+
description: new TM("settings.misc.exchange_rate.fixer_api_key.help"),
38+
envVar: "FIXER_API_KEY", envVarMode: EnvVarMode::OVERWRITE,
39+
)]
40+
public ?string $fixerApiKey = null;
41+
}

src/Settings/MiscSettings/MiscSettings.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ class MiscSettings
3131
{
3232
#[EmbeddedSettings]
3333
public ?KiCadEDASettings $kicadEDA = null;
34+
35+
#[EmbeddedSettings]
36+
public ?ExchangeRateSettings $exchangeRate = null;
3437
}

translations/messages.en.xlf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12976,5 +12976,23 @@ Please note, that you can not impersonate a disabled user. If you try you will g
1297612976
<target>Set to false to include non-authorized offers in the results</target>
1297712977
</segment>
1297812978
</unit>
12979+
<unit id="iRDDtdU" name="settings.misc.exchange_rate">
12980+
<segment>
12981+
<source>settings.misc.exchange_rate</source>
12982+
<target>Money exchange rates</target>
12983+
</segment>
12984+
</unit>
12985+
<unit id="0REngfi" name="settings.misc.exchange_rate.fixer_api_key">
12986+
<segment>
12987+
<source>settings.misc.exchange_rate.fixer_api_key</source>
12988+
<target>Fixer.io API Key</target>
12989+
</segment>
12990+
</unit>
12991+
<unit id="COLhoWD" name="settings.misc.exchange_rate.fixer_api_key.help">
12992+
<segment>
12993+
<source>settings.misc.exchange_rate.fixer_api_key.help</source>
12994+
<target>If you need exchange rates between non-euro currencies, you can input an API key from fixer.io here.</target>
12995+
</segment>
12996+
</unit>
1297912997
</file>
1298012998
</xliff>

0 commit comments

Comments
 (0)