-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Utility class to produce IConfigurationWire
instances
#241
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like everything but the names! Naming is hard...
// This SDK causes the cloud endpoint below to serve the UFC test file with bandit flags. | ||
const BANDIT_SDK_KEY = 'this-key-serves-bandits'; | ||
|
||
describe('ConfigurationWireHelper', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
*/ | ||
public static build( | ||
sdkKey: string, | ||
opts: SdkOptions = { sdkName: 'android', sdkVersion: '4.0.0' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any reason we're choosing these values for defaults? They seem extremely off from being default
* Fetches configuration data from the API and build a Bootstrap Configuration (aka an `IConfigurationWire` object). | ||
* The IConfigurationWire instance can be used to bootstrap some SDKs. | ||
*/ | ||
public async fetchBootstrapConfiguration(): Promise<IConfigurationWire> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we're calling it "bootstrap configuration" vs just "configuration"?
When I head "bootstrap configuration" I imagine: sdk key and set of urls to fetch configuration from
/** | ||
* Helper class for fetching and converting configuration from the Eppo API(s). | ||
*/ | ||
export class ConfigurationWireHelper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks extremely similar to configuration fetcher. Is there a significant difference? can this be just a new configuration fetcher?
|
||
if (!configResponse?.flags) { | ||
console.warn('Unable to fetch configuration, returning empty configuration'); | ||
return Promise.resolve(ConfigurationWireV1.empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: given the function is async
, I'm pretty sure you can just do this here:
return ConfigurationWireV1.empty();
Towards FF-4076
Stacked on #240
Motivation and Context
The gen2 offline init (aka, bootstrap) requires an
IConfigurationWire
payload (instead of just the flag UFC json, which does not contain bandits).Users of this
bootstrap
api will need to be able to generate the payload.Description
ConfigurationWireHelper
class to fetch configs from the Eppo API endpoints and re-encode them as anIConfigurationWire
instanceHow has this been tested?