Managing Configuration Patterns

1. Externalized Configuration Pattern

SourceUse
Env Variables12-factor; per-deploy overrides
Config FilesMounted ConfigMaps / files
Config ServerSpring Cloud Config, etcd, Consul KV
Cloud Param StoreSSM Parameter Store, GCP Runtime Config
NeverHardcode env-specific values

2. Configuration Server Pattern

CapabilityDetail
Central StoreVersioned config repo (often git-backed)
Environment Profilesdev / stage / prod overlays
RefreshPush (webhook) or pull (poll) updates
EncryptionEncrypt secret values at rest
ToolsSpring Cloud Config, Consul, etcd, AWS AppConfig

3. Service Template Pattern

AspectDetail
DefinitionBoilerplate / scaffold for new services (build, CI/CD, observability)
ToolsBackstage software templates, Cookiecutter, Yeoman
BenefitsConsistency, faster onboarding, golden path

4. Configuration Versioning Pattern

PracticeDetail
Git-BackedConfig in version control; PR review
Pinned VersionsService references config commit/tag
RollbackRevert config without redeploy
AuditWho changed what, when

5. Feature Toggle Pattern

Toggle TypeLifespan
Release TogglesDays/weeks; hide unfinished work in trunk
Experiment TogglesHours/days; A/B testing
Ops TogglesLong-lived; kill switches
Permission TogglesPermanent; per-user / per-tenant features
ToolsLaunchDarkly, Unleash, Flagsmith, ConfigCat

Example: Feature Flag Use

if (flags.isEnabled("new-checkout-flow", userContext)) {
    return newCheckoutService.process(req);
}
return legacyCheckoutService.process(req);

6. Dynamic Configuration Pattern

AspectDetail
DefinitionConfig changes apply without restart
ImplementationWatch config source; hot-reload listeners
ValidationValidate before applying; rollback on error
Use CasesLog levels, rate limits, feature flags, tunables

7. Environment-Specific Configuration Pattern

ApproachDetail
Profile-Basedapplication-{profile}.yaml overlay
Per-Env BranchesGitOps with env-specific config
Helm ValuesPer-env values.yaml
AvoidIf/else branching on env in code

8. Secrets Configuration Pattern

PatternDetail
External VaultVault, KMS-backed
Sidecar InjectionVault Agent injects to pod filesystem
CSI DriverMount secrets as files (K8s Secrets Store CSI)
Sealed/EncryptedSealed Secrets, SOPS for git storage

9. Configuration Inheritance Pattern

LayerOverride Order
DefaultsLowest precedence
ProfilePer-environment
Local FilePer-instance
Env VariablesHigher
CLI ArgsHighest

10. Configuration Validation Pattern

WhenDetail
At StartupFail fast if invalid; refuse to start
At PR TimeSchema validation in CI
At Apply TimeDry-run before live
SchemasJSON Schema, Spring @ConfigurationProperties + JSR-303