Pular para o conteúdo principal
Versão: main (dev) 🚧

ITLab.Template.DevPack.AppSettings

Centralizes strongly typed option models for cross-cutting infrastructure features.

Componentes

TipoNomeResponsabilidade
ClassApplicationOptionsApp metadata, frontend URL and CORS origins
ClassCacheOptionsCache expiration defaults
ClassConnectionStringsInfrastructure connection strings
Sealed ClassEmailOptionsEmail settings: provider selector, default from/sender, nested SMTP and SendGrid options
Sealed ClassSmtpOptionsSMTP delivery settings (host/port/ssl/credentials/delivery method/pickup directory)
Sealed ClassSendGridOptionsSendGrid settings (ApiKey)
ClassJwtOptionsJWT issuance settings
ClassLdapOptionsLDAP integration settings
ClassLoggerOptionsLogging provider behavior
ClassMicrosoftEntraIdOptionsEntra authentication settings
ClassMultiTenancyOptionsDomain/subdomain tenant resolution + cross-check (opt-in via EnableDomainValidation)
Sealed ClassAlternateDomainOptionLiteral host→tenant override consulted before DomainFormats
ClassScheduledJobsOptionsScheduler global settings and job list
ClassServiceBusOptionsService Bus namespace settings
ClassSignalROptionsSignalR endpoint settings

Como usar

// Strongly typed options registration with section path from each model.
services.AddOptions<ApplicationOptions>()
.BindConfiguration(ApplicationOptions.ConfigSectionPath)
.ValidateOnStart();

services.AddOptions<JwtOptions>()
.BindConfiguration(JwtOptions.ConfigSectionPath)
.ValidateOnStart();

O que não fazer

  • Do not mutate options classes at runtime to carry request-specific state.
  • Do not keep production defaults permissive (for example wildcard CORS fallback).

Extensão pelo produto

  • Products can add product-specific option classes implementing IAppOptions.
  • Products should keep section names stable to avoid deployment regressions.