Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the webhook field to have the field Notifiers instead #74

Merged
merged 4 commits into from
Mar 30, 2021

Conversation

thomaspoignant
Copy link
Owner

@thomaspoignant thomaspoignant commented Mar 30, 2021

Description

  • The config field Webhooks used to notify an API when a flag has changed is too restrictive because we need to have other types of service to call when a flag has changed.

    This PR introduces a new field called Notifiers in place of the Webhooks field to be able to have different types of notifiers when a flag has changed (slack can be a great example).

    Based on that the field Webhooks is deprecated and will continue to be supported in the next versions.
    It will be removed in a future release. (Check migration section bellow to see how to re-configure your webhooks).

  • This PR contains also a small change around the HTTPClient used at different place to have a central place where we can configure it.

Migration

If you were using Webhooks before, you should have a configuration like this:

ffclient.Init(ffclient.Config{ 
    Retriever:      &ffclient.FileRetriever{Path: "testdata/flag-config.yaml"},
    FileFormat:     "yaml",
    Webhooks:       []ffclient.WebhookConfig{
        {
            PayloadURL: " https://example.com/hook",
            Secret:     "Secret",
            Meta: map[string]string{
                "app.name": "my app",
            },
        },
    },
}

With Notifiers, your configuration should looks like this now:

ffclient.Init(ffclient.Config{ 
    Retriever:      &ffclient.FileRetriever{Path: "testdata/flag-config.yaml"},
    FileFormat:     "yaml",
    Notifiers: []ffclient.NotifierConfig{
        &ffclient.WebhookConfig{
            PayloadURL: " https://example.com/hook",
            Secret:     "Secret",
            Meta: map[string]string{
                "app.name": "my app",
            },
        },
    },
}

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking changes (change that is not backward-comptible and/or changes current functionality)

Checklist

  • I have tested this code
  • I have added unit test to cover this code
  • I have updated the Readme
  • I have followed the contributing guide

@sonarcloud
Copy link

sonarcloud bot commented Mar 30, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@thomaspoignant thomaspoignant merged commit 096f95b into main Mar 30, 2021
@thomaspoignant thomaspoignant deleted the feat/deprecate-webhook branch March 30, 2021 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant