Flipt
Load a flag from Flipt, the Go-native open-source feature-flag server.
| Scheme | flipt:// |
| Module | github.com/xavidop/mamori/providers/flipt |
| Sensitive | no |
| Watch | poll |
| Auth | FLIPT_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>]
| Part | Required | What it means |
|---|---|---|
<namespace> | yes | The Flipt namespace (use default if you have not created others). |
<flag-key> | yes | The flag key. |
?entity= | no | The 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-billingon a boolean flag resolves totrue/false.flipt://default/experiment-a?entity=service-1on a variant flag resolves to the variant matched forservice-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 code | mamori kind |
|---|---|
PermissionDenied | permission_denied |
Unauthenticated | unauthenticated |
Unavailable, DeadlineExceeded | unavailable |
ResourceExhausted | rate_limited |
NotFound, InvalidArgument | not classified here (deliberately) |
| anything else | unknown |
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.