0.11.0 • Published 1 year ago
@justeat/f-feature-management v0.11.0
Feature Management
This service allows querying of feature flags as configured using the Feature Management service via an injectable Nuxt plugin
Usage
To create an instance of the service:
const featuresService = new FeaturesService(store, {
httpClient: $axios, // nuxt-axios plugin instance or compliant http client
cookies: $cookies, // cookie-universal-nuxt plugin or compliant cookie store
analytics: $gtm, // @justeat/f-analytics instance
log: $log // See below
});
To manually fetch a new configuration file from the CDN:
await featuresService.update();
To inject as a nuxt plugin:
inject('features', featuresService.plugin);
Configuration
The following configuration should be available in the store:
{
scope: 'my-scope', // your team / component scope
environment: 'development', // development | production
obfuscationKey: 'xtpEe9PoYlHTv14hJq6m', // key provided with scope
pollInterval: 1000 * 60 // How frequently config should be polled for in ms
}
The service accesses this configuration from the store at the following location:
store.state.configuration.settings.featureManagement
Logging
The log class must provide the following interface:
class Log {
info (message, tags, payload = {}) { ... }
warn (message, tags, payload = {}) { ... }
error (message, exception, tags, payload = {}) { ... }
}