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

Call webhook when a flag changed #65

Merged
merged 6 commits into from
Feb 3, 2021
Merged

Conversation

thomaspoignant
Copy link
Owner

@thomaspoignant thomaspoignant commented Feb 3, 2021

Description

This PR adds the possibility to call some webhooks when a flag is changed.
All the webhooks are called in parallel with a POST request with the format bellow.

We can signed the request using HMAC/sha-256 with the secret passed in the configuration.

{
  "meta":{
      "hostname": "server01"
  },
  "flags":{
      "deleted": {
          "test-flag": {
              "rule": "key eq \"random-key\"",
              "percentage": 100,
              "true": true,
              "false": false,
              "default": false
          }
      },
      "added": {
          "test-flag3": {
              "percentage": 5,
              "true": "test",
              "false": "false",
              "default": "default"
          }
      },
      "updated": {
          "test-flag2": {
              "old_value": {
                  "rule": "key eq \"not-a-key\"",
                  "percentage": 100,
                  "true": true,
                  "false": false,
                  "default": false
              },
              "new_value": {
                  "disable": true,
                  "rule": "key eq \"not-a-key\"",
                  "percentage": 100,
                  "true": true,
                  "false": false,
                  "default": false
              }
          }
      }
  }
}

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)

Closes issue(s)

Resolve #16

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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 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 c9edddb into main Feb 3, 2021
@thomaspoignant thomaspoignant deleted the feat/webhook-notif branch February 3, 2021 13:51
thomaspoignant added a commit that referenced this pull request Oct 11, 2021
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.

(feature) Be notified when a flag change
1 participant