π½ 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.
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
.
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.
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.