Secrets: Adding developer mode config (#111008)

adding developer mode and feature flags for e2e tests
This commit is contained in:
Dana Axinte
2025-09-18 10:10:24 +01:00
committed by GitHub
parent fcf781c24a
commit 1f071f5bd7
4 changed files with 32 additions and 1 deletions
+4
View File
@@ -34,6 +34,8 @@ type SecretsManagerSettings struct {
GCWorkerPollInterval time.Duration
// How long to wait for the process to clean up a secure value to complete.
GCWorkerPerSecureValueCleanupTimeout time.Duration
// Whether the secrets management is running in developer mode.
IsDeveloperMode bool
}
func (cfg *Cfg) readSecretsManagerSettings() {
@@ -53,6 +55,8 @@ func (cfg *Cfg) readSecretsManagerSettings() {
cfg.SecretsManagement.GCWorkerPollInterval = secretsMgmt.Key("gc_worker_poll_interval").MustDuration(1 * time.Minute)
cfg.SecretsManagement.GCWorkerPerSecureValueCleanupTimeout = secretsMgmt.Key("gc_worker_per_request_timeout").MustDuration(5 * time.Second)
cfg.SecretsManagement.IsDeveloperMode = secretsMgmt.Key("developer_mode").MustBool(false)
// Extract available KMS providers from configuration sections
providers := make(map[string]map[string]string)
for _, section := range cfg.Raw.Sections() {
@@ -170,4 +170,26 @@ domain = example.com
assert.Equal(t, MisconfiguredProvider, cfg.SecretsManagement.CurrentEncryptionProvider)
assert.Empty(t, cfg.SecretsManagement.ConfiguredKMSProviders)
})
t.Run("should handle configuration with developer mode on", func(t *testing.T) {
iniContent := `
[secrets_manager]
developer_mode = true
`
cfg, err := NewCfgFromBytes([]byte(iniContent))
require.NoError(t, err)
assert.True(t, cfg.SecretsManagement.IsDeveloperMode)
})
t.Run("should handle configuration without developer mode set", func(t *testing.T) {
iniContent := `
[secrets_manager]
encryption_provider = aws_kms
`
cfg, err := NewCfgFromBytes([]byte(iniContent))
require.NoError(t, err)
assert.False(t, cfg.SecretsManagement.IsDeveloperMode)
})
}