9c0bf76a05
Playwright Tests / test (push) Has been cancelled
Added detailed instruction files for configuration, controller structure, C# standards, OCORE library usage, ImageSharp licensing, and testing. These documents define rules for settings, DI, file layout, package management, and test practices to ensure consistency and compliance during the .NET 10 migration.
2.2 KiB
2.2 KiB
applyTo
| applyTo |
|---|
| Fuchs/**,Fuchs_DataService/** |
Configuration & Secrets Instructions
Settings Source
- All application settings live in
Fuchs/appsettings.json. Never useWeb.configorSystem.Configuration.ConfigurationManagerfor app settings. - App-specific settings are nested under the
"Fuchs"key, e.g._config["Fuchs:SMS_APIKey"]. - Connection strings live under the standard
"ConnectionStrings"key and are read viaIConfiguration.GetConnectionString(...). appsettings.Development.json(git-ignored) overrides secrets for local development.
Startup Order
- Call
FuchsOcmsIntranet.Initialize(configuration)at app start inProgram.csbefore DI registration. Fuchs_intranetreceivesIConfigurationvia its constructor — inject it, never read config statically.
Azure Key Vault — Secret Naming
Secret names must satisfy ^[0-9a-zA-Z-]+$ (alphanumerics and hyphens only; no underscores, dots, or spaces).
- Hierarchy levels are separated by
--(double hyphen), which maps to:inIConfiguration. - Underscores within a name segment are encoded as a single
-in Key Vault and decoded back to_when the key is reconstructed. - The app prefix
fuchsis prepended to every secret name. - Format:
{appname}--{Section}--{key-with-hyphens-for-underscores}
Examples
| Key Vault name | IConfiguration key |
|---|---|
fuchs--ConnectionStrings--ocms-ConnectionString |
ConnectionStrings:ocms_ConnectionString |
fuchs--Fuchs--SMS-APIKey |
Fuchs:SMS_APIKey |
fuchs--Fuchs--Email--Main--password |
Fuchs:Email:Main:password |
Adding a New Secret
- Replace every
_in the original config key with-for the Key Vault name. - Add the entry to
ManagedSecretKeysinappsettings.jsonusing the same hyphenated form without thefuchs--prefix. - Read it through
IConfigurationwith the underscore form (Fuchs:SMS_APIKey).
Secret Management Wiring
- Secret management is provided by
OCORE_web.Secrets.SecretManagementWebExtensions.AddSecretManagement(...)(called inProgram.cs). - Do not create a local
SecretManagementExtensionsstub in Fuchs — it collides with the OCORE_web extension and causes ambiguous extension-method resolution.