Use a special form type for api key settings, that hide the api key by default as dots

This commit is contained in:
Jan Böhmer 2025-08-24 20:04:52 +02:00
parent a75a60fecd
commit f48791e961
16 changed files with 191 additions and 12 deletions

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\Settings\InfoProviderSystem;
use App\Form\Type\APIKeyType;
use App\Settings\SettingsIcon;
use Jbtronics\SettingsBundle\Metadata\EnvVarMode;
use Jbtronics\SettingsBundle\Settings\Settings;
@ -35,6 +36,7 @@ use Symfony\Component\Translation\TranslatableMessage as TM;
class MouserSettings
{
#[SettingsParameter(label: new TM("settings.ips.mouser.apiKey"), description: new TM("settings.ips.mouser.apiKey.help"),
formType: APIKeyType::class,
formOptions: ["help_html" => true], envVar: "PROVIDER_MOUSER_KEY", envVarMode: EnvVarMode::OVERWRITE)]
public ?string $apiKey = null;
@ -64,4 +66,4 @@ class MouserSettings
return MouserSearchOptions::tryFrom($value) ?? MouserSearchOptions::NONE;
}
}
}