Flipt

Load a flag from Flipt, the Go-native open-source feature-flag server.

Schemeflipt://
Modulegithub.com/xavidop/mamori/providers/flipt
Sensitiveno
Watchpoll
AuthFLIPT_URL (+ optional token)

Install

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

Using the ref

A flipt:// ref points at one flag within a namespace, evaluated for an entity.

flipt://<namespace>/<flag-key>[?entity=<id>]
PartRequiredWhat it means
<namespace>yesThe Flipt namespace (use default if you have not created others).
<flag-key>yesThe flag key.
?entity=noThe evaluation entity id. Defaults to mamori.

A boolean flag resolves to true / false; a variant flag resolves to the matched variant key. A flag that does not exist resolves to not-found.

Examples

  • flipt://default/new-billing on a boolean flag resolves to true / false.
  • flipt://default/experiment-a?entity=service-1 on a variant flag resolves to the variant matched for service-1.

Watch

Flipt is evaluated over its API; mamori polls (WithPollInterval + jitter).

Error classification

Beyond the not-found case, other evaluation failures are classified by gRPC status:

gRPC codemamori kind
PermissionDeniedpermission_denied
Unauthenticatedunauthenticated
Unavailable, DeadlineExceededunavailable
ResourceExhaustedrate_limited
NotFound, InvalidArgumentnot classified here (deliberately)
anything elseunknown

NotFound already drives not-found before classification runs, and InvalidArgument is Flipt’s flag-type-mismatch signal, consumed internally to trigger the boolean/variant fallback rather than surfaced as an error, so neither is remapped here. The typed errors flipterrors.ErrUnauthenticated and flipterrors.ErrUnauthorized are also checked, mapping to unauthenticated and permission_denied respectively.

Configuration

import fliptprov "github.com/xavidop/mamori/providers/flipt"

mamori.WithProvider(fliptprov.New(
	fliptprov.WithURL(os.Getenv("FLIPT_URL")),
	fliptprov.WithToken(os.Getenv("FLIPT_TOKEN")),
))

Verified with an injected fake (un-seeded flags resolve to not-found, and injected gRPC status errors exercise error classification through Resolve); live behavior is covered by //go:build integration tests.