v0.26.0
v0.26.0
📝 Release note
- Move retriever / notifier / exporter on their own packages. by @thomaspoignant in #264
Full Changelog: v0.25.2...v0.26.0
⚠️ Breaking changes ⚠️
This version change the way to do your SDK initialization in particular when it comes to notifier
, provider
and exporter
.
Why are we doing this breaking changes?
This change is needed because we are adding more and more retriever / exporter and notifier, and with that we are also adding more dependencies to the project.
And since all the dependencies are in the same package we were increasing the size of your build even if you were not using the new providers.
The best example is when we introduce the kubernetes provider, it has added ~20Mo in your application because the client-go
from kubernetes is huge.
What did we change?
We have moved all retriever / exporter and notifier in a dedicated package for each of them.
With this new organisation when building your app we will use only the dependencies related to your configuration.
We also change the way to deal with the notifiers
to align it with the way it work for other extensions.
How to migrate?
Edit your init function of go-feature-flag
and replace your retriever, exporter, notifier following this.
Retrievers
ffclient.FileRetriever -> fileretriever.Retriever
ffclient.GithubRetriever -> gcstorageretriever.Retriever
ffclient.GithubRetriever -> githubretriever.Retriever
ffclient.HTTPRetriever -> httpretriever.Retriever
ffclient.KubernetesRetriever -> k8sretriever.Retriever
fflcient.S3Retriever -> s3retriever.Retriever
Exporters
ffexporter.File -> fileexporter.Exporter
ffexporter.GoogleCloudStorage -> gcstorageexporter.Exporter
ffexporter.Log -> logsexporter.Exporter
ffexporter.S3 -> s3exporter.Exporter
ffexporter.Webhook -> webhookexporter.Exporter
Notifiers
Since in this PR we change the way to work with notifier, you have more impact when configuring them.
Before this PR to configure a notifier you had something like that.
_, err := ffclient.New(ffclient.Config{
// ...
Notifiers: []ffclient.NotifierConfig{
&ffclient.WebhookConfig{
// ...
},
},
})
With this PR we had remove the ffclient.NotifierConfig
struct to use directly the notifier
them self.
It means that now ffclient.Config.Notifiers
has the type []notifier.Notifier
.
So it will look like:
_, err := ffclient.New(ffclient.Config{
// ...
Notifiers: []notifier.Notifier{
&webhooknotifier.Notifier{
// ...
},
},
})
To follow the same pattern has the retrievers
and exporters
we also have changed the struct you were using.
notifier.LogNotifier -> logsnotifier.Notifier
ffclient.SlackNotifier -> slacknotifier.Notifier
ffclient.WebhookConfig -> webhooknotifier.Notifier