Flagsmith

Load a Flagsmith flag’s value or state as config.

Schemeflagsmith://
Modulegithub.com/xavidop/mamori/providers/flagsmith
Sensitiveno
Watchpoll
AuthFLAGSMITH_ENVIRONMENT_KEY

Install

go get github.com/xavidop/mamori/providers/flagsmith
import _ "github.com/xavidop/mamori/providers/flagsmith"

Using the ref

A flagsmith:// ref points at one flag. Without a fragment it resolves to the flag’s value; #enabled resolves to its on/off state.

flagsmith://<feature-name>[#enabled]
PartRequiredWhat it means
<feature-name>yesThe Flagsmith feature name.
#enablednoResolve to the feature’s enabled state (true / false) instead of its value.

A feature that does not exist resolves to not-found.

Examples

  • flagsmith://banner_text resolves to the feature’s value (a string, number, or JSON).
  • flagsmith://new_dashboard#enabled resolves to true / false - pair it with a bool field.

Error classification

Flagsmith’s SDK exposes no structured error vocabulary beyond feature-not-found, so this provider does not classify errors into finer kinds: mamori.ErrorKind reports unknown for anything other than not_found. Resolve propagates a backend error unchanged (never flattened with %v), so errors.Is / errors.As and any wrapped mamori sentinel survive the chain intact.

Watch

mamori polls (WithPollInterval + jitter); the Flagsmith client also refreshes internally.

Configuration

import flagsmithprov "github.com/xavidop/mamori/providers/flagsmith"

mamori.WithProvider(flagsmithprov.New(
	flagsmithprov.WithEnvironmentKey(os.Getenv("FLAGSMITH_ENVIRONMENT_KEY")),
))
// self-hosted: add flagsmithprov.WithBaseURL("https://flagsmith.internal/api/v1/")

Verified with an injected fake (un-seeded features resolve to not-found); live behavior is covered by //go:build integration tests.