features

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 12 Imported by: 0

README

features-go

Go Reference

Feature Flags Go client.

Install

go get github.com/altipla-consulting/features-go

Usage

Configure features

To configure features, you need to run features configure, passing the server URL and the project corresponding to the flags.

func main() {
  features.Configure("https://youserver.com", "project")
}
Check feature flag is enabled
if features.Flag(ctx, "feature") {
    fmt.Print("Feature flag is enabled.")
}
Check feature flag is enabled with tenant
if features.Flag(ctx, "feature", features.WithTenant("tenant")) {
    fmt.Print("Feature flag is enabled with tenant.")
}

Contributing

You can make pull requests or create issues in GitHub. Any code you send should be formatted using make gofmt.

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient *featuresClient

Functions

func Configure

func Configure(serverURL, project string, opts ...ConfigureOption)

Initializes the feature client with the provided server URL and project, and starts a background synchronization process.

func Flag

func Flag(code string, opts ...FlagOption) bool

Flag returns true if the flag is enabled with the given options.

Types

type ConfigureOption added in v0.2.0

type ConfigureOption func(*configureOptions)

func WithDisableStats added in v0.2.0

func WithDisableStats(disabled bool) ConfigureOption

func WithLogger added in v0.2.0

func WithLogger(logger *slog.Logger) ConfigureOption

type FlagOption

type FlagOption func(*flagOptions)

func WithTenant

func WithTenant(tenant string) FlagOption

WithTenant sets the tenant for the flag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL