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

Allow multiple go-feature-flag #58

Merged
merged 6 commits into from
Jan 18, 2021
Merged

Conversation

thomaspoignant
Copy link
Owner

@thomaspoignant thomaspoignant commented Jan 18, 2021

Description

This PR allows you to have multiple go-feature-flag instances in the same application.
Nothing changes if you don't need it, you can still use the built-in singleton like provided by the package.

If you need to use files from different places you can create your own instance of go-feature-flag:

x, err := ffclient.New(Config{ Retriever: &ffclient.HTTPRetriever{{URL: "http://example.com/test.yaml",}})
defer x.Close()
y, err := ffclient.New(Config{ Retriever: &ffclient.HTTPRetriever{{URL: "http://example.com/test2.yaml",}})
defer y.Close()

user := ffuser.NewUser("user-key")
x.BoolVariation("test-flag", user, false)
y.BoolVariation("test-flag", user, 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 #56

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

@thomaspoignant thomaspoignant added the enhancement New feature or request label Jan 18, 2021
@thomaspoignant thomaspoignant marked this pull request as ready for review January 18, 2021 10:00
@sonarqubecloud
Copy link

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 552fc5e into main Jan 18, 2021
@thomaspoignant thomaspoignant deleted the feat/multiple-instances branch January 18, 2021 10:18
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
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow multiple go-feature-flag at the same time.
1 participant