-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (28 loc) · 1.1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//Connect to launch darkly
var LaunchDarkly = require('launchdarkly-node-server-sdk');
var ldclient = LaunchDarkly.init('sdk-d9ea449d-7652-431d-a8fa-9275875a8013');
var user = {
key: 'user1',
custom: {
groups: 'beta_testers'
}
};
//Main execution:
ldclient.once('ready', function() {
console.log('');
console.log('');
console.log('This text represents an old feature that already exists in our app');
console.log('');
ldclient.variation('greytest', user, false, function(err, showFeature) {
// console.log("SDK successfully connected! The value of greytest is " + showFeature + " for " + user.key)
if (showFeature === true) {
console.log('This text represents a new feature for which we are implementing feature flagging. ' +
'This text should only appear if we are user Ruby Rod (user key of \'user1\'), due to my basic ' +
'implementation of targeting. Edit the index.js file and change the user key to user2 and see this text ' +
'disappear upon a subsequent run of the program');
}
});
ldclient.flush(function() {
ldclient.close();
});
});