README
Lemonflags
DynamoDB-based feature flag library for Lemonstand.
Usage
In code
import { Lemonflags } from '@lemonstand.org/lemonflags'
const flags = new Lemonflags(DYNAMODB_ENDPOINT, AWS_REGION, TABLE_NAME);
const f = await flags.isFeatureEnabled("feature-name", 15, 22);
if (f) {
// show feature
} else {
// don't show feature
}
You might also need to declare permissions for your app in order to read the table:
# serverless.yml
provider:
iamRoleStatements:
- Effect: "Allow"
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
Resouce: ${lemonflagsARN}
As you can see, this library is read-only; we assume you have some other way of toggling the feature flags.
Setting flags
The schema declares only two fields: feature
and game_instance_id
. However,
we expect a third field: enabled
.
feature
is the string label of the feature we want to flag.game_instance_id
is a composite field of the game id and the instance id, delimited with a dash.enabled
is a boolean field.