Skip to main content
Version: v1.40.0

πŸ’½ Store your flags’ configuration

Overview​

GO Feature Flag is a tool that makes it easy to implement feature flags in your application.

One of the benefits of using GO Feature Flag is that it is designed to be simple and lightweight.
To achieve this, the solution offers flexible ways to manage and store your feature flag configurations.

The goal is to let you store your flag configuration where is suits you the best, and to do this we have built a list of retrievers that are able to load your file from different sources.

πŸ“ Where to store the flag's configuration​

The easiest way to get started with GO Feature Flag is to store your flags' configuration in a file.

You can then upload those files where you want, and GO Feature Flag will use it. The way the solution achieves this is through the use of retrievers, which allow you to load your feature flag configuration file from various sources.

GO Feature Flag supports a variety of retrievers out of the box (see list bellow).

You have 2 different ways to specify a retriever depending on if you are using the GO Module or the Relay Proxy. In all the detail pages of the retrievers bellow you will have an example for both examples.

Available retrievers​

Bellow is the full list of retrievers that are available in GO Feature Flag.

logo
HTTP(S)

Fetches the configuration from a remote URL over HTTP(S).

More details
logo
File System

Fetch the configuration from a local file.

More details
logo
Kubernetes ConfigMap

Loads the configuration from a Kubernetes ConfigMap.

More details
logo
AWS S3

Retrieves the configuration from an AWS S3 bucket.

More details
logo
Google Cloud Storage

Retrieves the configuration from a Google Cloud Storage bucket.

More details
logo
Azure Blob Storage

Retrieves the configuration from an Azure Blob Storage.

More details
logo
GitHub

Fetch the configuration from files stored in a GIT repository.

More details
logo
GitLab

Fetch the configuration from files stored in a GIT repository.

More details
logo
Bitbucket

Fetch the configuration from files stored in a GIT repository.

More details
logo
MongoDB

Load the configuration from a MongoDB collection.

More details
logo
Redis

Load the configuration from Redis using a specific prefix.

More details

Custom retriever​

If you have a specific use case that is not covered by the built-in retrievers, you can create your own custom retriever.

To achieve this, you need to implement the InitializableRetriever interface in your custom retriever.

type InitializableRetriever interface {
Retrieve(ctx context.Context) ([]byte, error)
Init(ctx context.Context, logger *fflog.FFLogger) error
Shutdown(ctx context.Context) error
Status() retriever.Status
}

To avoid any issue to call the Retrieve function before the Init function, you have to manage the status of your retriever. GO Feature Flag will try to call the Retrieve function only if the status is RetrieverStatusReady.

note

If you think your custom retriever could be useful for others, feel free to open a pull request to add it to the list of available retrievers.

warning

If you are using a custom retriever, it is easy to use it for the GO Module, but if you want to use it in the relay proxy you will have to recompile it yourself.