GRPC node client for feacture flags service
npm install featureflags-clientgrpc lib, for featureflags service. Provides abilitty to gracefull set and updates> .proto files were taken directly from repo above.
> They should be uploaded in some place from the root repo on deploy i guess
FeatureClient is the base class. With it's constructor u will init grpc client, wich will call ExchangeRequesteventloop much, or app performance, coz of inmemory caching and time interval.So u do this on application start:
``js
import { FeatureClient, Variable, Types } from '@evo/featureflags-client';
// Ur default flags dict
const Flags = {
TEST: false,
NODE: false
};
const featureClient = new FeatureClient(
'thecorp', // project name
'grpc:50051', // grpc-url
Flags, // default flags
[
new Variable('username', Types.STRING) // ur controll values for Checks
],
true, // isDebugg mode
);
`
In ur controllers, or somewhere when ur need ur features to work properly,
call getFlags, and provide there context = {}. Ctx is the object with Variable as a key,
and a value u want checks to depend on.
`js
import { getFlags } from '@evo/featureflags-client';
// ready to use object with proceeded checks
const flags = getFlags({ username: 'Petro' });
if (flags.TEST) doSomeThing();
``
- StatsController - Accumulates interval/flag/requests count
- Tracer - Accumulates request/flag/values