Forge
1.x
Docs/Forge/Configuration
Open

Reading1 min
Updated31 Jul 2026
Sourcev1/extensions/features/configuration.mdx

YAML Configuration Example01

extensions:
  features:
    enabled: true
    provider: "local"                # "local", "launchdarkly", "unleash", "flagsmith", "posthog"
    refreshInterval: "30s"
    enableCache: true
    cacheTTL: "5m"

    defaultFlags:
      new-dashboard: true
      max-items: 100

    local:
      flags:
        new-dashboard:
          enabled: true
          defaultValue: true
        dark-mode:
          enabled: false
          defaultValue: false
        max-items:
          enabled: true
          defaultValue: 50

The extension loads config from extensions.features first, falling back to features.

Programmatic Configuration02

ext := features.NewExtension(
    features.WithProvider("local"),
    features.WithRefreshInterval(1 * time.Minute),
    features.WithCache(true, 10*time.Minute),
    features.WithDefaultFlags(map[string]any{
        "new-dashboard": true,
        "max-items":     100,
    }),
)

Config Struct Reference03

FieldTypeDefaultDescription
EnabledbooltrueEnable the extension
Providerstring"local"Feature flag provider
RefreshIntervaltime.Duration30sFlag refresh interval
EnableCachebooltrueEnable flag value caching
CacheTTLtime.Duration5mCache TTL
DefaultFlagsmap[string]any{}Default flag values
Local.Flagsmap[string]FlagConfig{}Local flag definitions

FlagConfig

FieldTypeDescription
EnabledboolWhether the flag is active
DefaultValueanyDefault value when enabled

Option Helpers04

FunctionDescription
WithProvider(provider)Set the flag provider
WithRefreshInterval(interval)Set refresh interval
WithCache(enabled, ttl)Configure caching
WithDefaultFlags(flags)Set default flag values
WithConfig(config)Provide a complete config struct