Retrieve your feature flags configuration
The module supports different ways of retrieving the flag file.
Available retrievers
📄️ HTTP endpoint
The HTTP Retriever
📄️ S3 Bucket
The S3 Retriever v2 will use the aws-sdk-go-v2 to access your flag in an S3 bucket.
📄️ Kubernetes configmaps
A ConfigMap is an API object used to store non-confidential data in key-value pairs inside kubernetes.
📄️ Google Cloud Storage
The Google Cloud Storage Retriever will use the google-cloud-storage package and google-api-options package to access your flag in Google Cloud Storage.
📄️ GitHub
The GitHub Retriever
📄️ GitLab
The GitLab Retriever
📄️ Bitbucket
The Bitbucket Retriever
📄️ MongoDB
The mongodbRetriever will use the mongoDB database to get your flags.
📄️ Redis
The redisRetriever will use the redis database to get your flags.
📄️ File
The File Retriever will read a local file to get your flags.
📄️ Custom Retriever
Simple retriever
To retrieve a file you need to provide a retriever in your ffclient.Config{}
during the initialization.
If the existing retriever does not work with your system you can extend the system and use a custom retriever.
Explicitly call the retrievers
By default, the retrievers are called regularly to refresh the configuration based on the polling interval.
But there are use cases where you want to refresh the configuration explicitly (for example, during the CI process after you have changed your configuration file).
To do that, you can call the ForceRefresh
method on the client.
// Init ffclient with a file retriever.
goff, _ := ffclient.New(ffclient.Config{
PollingInterval: 10 * time.Minute,
Retriever: &fileretriever.Retriever{
Path: "xxxx.yaml",
},
})
// ...
goff.ForceRefresh()
// ...