-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Launch Darkly for feature flag management DEV-557 (#195)
* Catch machine status update failures * Added Launch Darkly
- Loading branch information
Showing
10 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,11 +37,14 @@ ID = "salad-web-app" | |
REACT_APP_AUTH0_CLIENT_ID='K8nT8zWF1Dyu9oqLJg5MTkpt9Aug3Ygt' | ||
REACT_APP_SENTRY_DSN = "https://[email protected]/1424792" | ||
REACT_APP_MIXPANEL_TOKEN = "68db9194f229525012624f3cf368921f" | ||
REACT_APP_LAUNCH_DARKLY_ID='5d8e2d2d5c49cd07a94926c2' | ||
|
||
[context.branch-deploy.environment] | ||
REACT_APP_AUTH0_CLIENT_ID='K8nT8zWF1Dyu9oqLJg5MTkpt9Aug3Ygt' | ||
REACT_APP_LAUNCH_DARKLY_ID='5d8e2d2d5c49cd07a94926c1' | ||
|
||
# Deploy Preview context: all deploys resulting from a pull/merge request will | ||
# inherit these settings. | ||
[context.deploy-preview.environment] | ||
REACT_APP_AUTH0_CLIENT_ID="OJ6ffJ2h4eYZr6HqswGF544WgqDcBn2h" | ||
REACT_APP_LAUNCH_DARKLY_ID='5d8e2d2d5c49cd07a94926c1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import featureFlags from './featureFlags.json' | ||
import * as LDSdk from 'launchdarkly-js-client-sdk' | ||
import { Config } from './config' | ||
|
||
export const featureFlag = (flag: string): boolean => { | ||
//@ts-ignore | ||
if (featureFlags.hasOwnProperty(flag)) { | ||
//@ts-ignore | ||
return featureFlags[flag] === true | ||
export class FeatureFlags { | ||
private ldClient: LDSdk.LDClient | undefined | ||
|
||
loadFeatureFlags = async (userId: string): Promise<void> => { | ||
this.ldClient = LDSdk.initialize(Config.launchDarklyId, { key: userId }) | ||
|
||
await this.ldClient.waitUntilReady() | ||
} | ||
|
||
getBool = (key: string, defaultValue: boolean = false): boolean => { | ||
if (this.ldClient) return this.ldClient.variation(key, defaultValue) | ||
return defaultValue | ||
} | ||
return false | ||
} | ||
|
||
const instance = new FeatureFlags() | ||
|
||
export { instance as featureFlags } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3910,7 +3910,7 @@ balanced-match@^1.0.0: | |
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" | ||
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= | ||
|
||
base64-js@^1.0.2, base64-js@^1.2.0, base64-js@^1.2.3: | ||
base64-js@1.3.0, base64-js@^1.0.2, base64-js@^1.2.0, base64-js@^1.2.3: | ||
version "1.3.0" | ||
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" | ||
integrity sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw== | ||
|
@@ -6757,7 +6757,7 @@ extsprintf@^1.2.0: | |
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" | ||
integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= | ||
|
||
fast-deep-equal@^2.0.1: | ||
fast-deep-equal@2.0.1, fast-deep-equal@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" | ||
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= | ||
|
@@ -9578,6 +9578,23 @@ latest-version@^3.0.0: | |
dependencies: | ||
package-json "^4.0.0" | ||
|
||
launchdarkly-js-client-sdk@^2.13.0: | ||
version "2.13.0" | ||
resolved "https://registry.yarnpkg.com/launchdarkly-js-client-sdk/-/launchdarkly-js-client-sdk-2.13.0.tgz#f269966cd09461a8bae42159b53ec4ebf70e119e" | ||
integrity sha512-KqMrKQidHR2O6XhZ++1QmLIwuSqhX+GNb48DGWcjWXRi35s/af3FbpVTx6Dh1KYl5K6wmOIgNVzKA3T4+m2m6g== | ||
dependencies: | ||
escape-string-regexp "1.0.5" | ||
launchdarkly-js-sdk-common "^2.13.0" | ||
|
||
launchdarkly-js-sdk-common@^2.13.0: | ||
version "2.13.0" | ||
resolved "https://registry.yarnpkg.com/launchdarkly-js-sdk-common/-/launchdarkly-js-sdk-common-2.13.0.tgz#2df51b8a34c3de2895797e8e10cc6849480e6a18" | ||
integrity sha512-Nhf+u9MSUzyDvTlbkdJXMJojL8M0dbm8S4rk3Nb8VsvYvLiANsDh6D58FPcl7I3n1NeeCprUk0us1y4QkO5TDQ== | ||
dependencies: | ||
base64-js "1.3.0" | ||
fast-deep-equal "2.0.1" | ||
uuid "3.3.2" | ||
|
||
lazy-cache@^0.2.3: | ||
version "0.2.7" | ||
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-0.2.7.tgz#7feddf2dcb6edb77d11ef1d117ab5ffdf0ab1b65" | ||
|
@@ -15445,7 +15462,7 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" | ||
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= | ||
|
||
uuid@^3.0.1, uuid@^3.3.2: | ||
uuid@3.3.2, uuid@^3.0.1, uuid@^3.3.2: | ||
version "3.3.2" | ||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" | ||
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== | ||
|