diff --git a/default.yaml b/default.yaml index c8cd720..5f57f61 100644 --- a/default.yaml +++ b/default.yaml @@ -42,3 +42,14 @@ rateLimits: # # path param is treated identically to a route declaring scope "ou" # # with {ou}. # orgUnitScope: "workspace" + +# Experimental features — not yet generally available. +# When absent, all experimental features remain disabled. +#experimental: +# # Enable org-unit soft-delete. When false (default), delete requests +# # return 501 Unimplemented. +# allow_ou_delete: true +# +# # Seconds to retain a soft-deleted org unit before the reconciler +# # hard-deletes it. Only meaningful when allow_ou_delete is true. +# hold_deleted_ou: 3600 diff --git a/pkg/config/config.go b/pkg/config/config.go index d086aeb..e35060f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -81,6 +81,20 @@ type ResourceAliasesConfig struct { OrgUnitScope string `yaml:"orgUnitScope,omitempty"` } +// ExperimentalConfig holds feature flags and settings for features +// that are not yet generally available. When absent from the config +// file, all experimental features remain disabled. +type ExperimentalConfig struct { + // AllowOUDelete enables the org-unit soft-delete feature. + // When false (default), delete requests return 501 Unimplemented. + AllowOUDelete bool `yaml:"allow_ou_delete"` + + // HoldDeletedOU is the duration in seconds to retain a + // soft-deleted org unit before the reconciler hard-deletes it. + // Only meaningful when AllowOUDelete is true. + HoldDeletedOU int `yaml:"hold_deleted_ou"` +} + // Base config struct type BaseConfig struct { ConfigDB *MongoDB `yaml:"configDB,omitempty"` @@ -90,6 +104,7 @@ type BaseConfig struct { Cors CorsConfig `yaml:"cors,omitempty"` RateLimits RateLimitsConfig `yaml:"rateLimits"` ResourceAliases ResourceAliasesConfig `yaml:"resourceAliases,omitempty"` + Experimental ExperimentalConfig `yaml:"experimental,omitempty"` } // get Config database information, if the struct @@ -159,6 +174,11 @@ func (c *BaseConfig) GetResourceAliases() ResourceAliasesConfig { return c.ResourceAliases } +// GetExperimental returns the experimental feature configuration. +func (c *BaseConfig) GetExperimental() ExperimentalConfig { + return c.Experimental +} + // Parse YAML Config file from the provided config file path // returns pointer to config structure and error if failed to // generate the config struct.