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

Feat: Bootstrapping #44

Merged
merged 5 commits into from
Feb 15, 2022
Merged

Feat: Bootstrapping #44

merged 5 commits into from
Feb 15, 2022

Conversation

RikudouSage
Copy link
Collaborator

closes #43

Implemented according to specifications - if the request to unleash api fails it falls back to a bootstrap provider (if present).

Also added a configuration parameter to disable fetching the api at all in which case these things are disabled:

  • fetching features
  • client registration
  • sending metrics

If fetching is disabled and no bootstrap is provided, an exception is thrown.

} catch (Exception $exception) {
// empty catch, $data does not exist and will be handled below
}
$data ??= $this->getBootstrappedResponse();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I have not seen that operator before!

Would it make sense to validate if it is anything more than an empty string?
What if it is an empty list of feature toggles?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty string couldn't pass here, an exception would be thrown somewhere in the providers. Empty feature toggle list is a valid response, no? For example, if your unleash server goes down you want to play it safe and don't let anyone see a list of any flag guarded features.

I can add some validator that it at least is in valid format to fail early, but I think we shouldn't check for more than the data having a "features" key and it being an array.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I think we shouldn't check for more than the data having a "features" key and it being an array.

Agreed!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivarconr I added the check in the latest commit.

Copy link
Contributor

@chriswk chriswk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job.

@RikudouSage
Copy link
Collaborator Author

RikudouSage commented Feb 9, 2022

@ivarconr @chriswk Just added a commit that checks for body validity and throws exception if it isn't valid, just let me know if it's ok and I can merge.

@ivarconr
Copy link
Member

@ivarconr @chriswk Just added a commit that checks for body validity and throws exception if it isn't valid, just let me know if it's ok and I can merge.

make sense.

@RikudouSage RikudouSage merged commit c23d7df into main Feb 15, 2022
@RikudouSage RikudouSage deleted the feature/bootstrapping branch February 15, 2022 11:20
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.

feat: Add support for bootstrapping feature toggles
3 participants