Repository navigation
SELA-1352 - Allow Launch Darkly query parameter overrides - #6
Conversation
jacobmoretti
left a comment
There was a problem hiding this comment.
Looks good so far! Just a few comments. I think its missing a piece of functionality. Also, whats the current state of the tests? I saw comments left in so wasn't sure.
| let override; | ||
| /** | ||
| * Follow this overriding convention: | ||
| * @link https://git.corp.tc/capsela/tc_feature_flagging#overriding-feature-flags |
There was a problem hiding this comment.
This link should be removed and include general guidance on how the query params should be formatted. Since its a link to our enterprise github, its not available for the public and doesn't provide any value for anyone but us.
| * @link https://git.corp.tc/capsela/tc_feature_flagging#overriding-feature-flags | ||
| **/ | ||
| const query = url.parse(window.location.toString(), true).query; | ||
| const queryFlag = query["features." + flagKey]; |
There was a problem hiding this comment.
This works for supporting the advanced overriding, e.g., ?features.flagA=true but I'm not seeing support for the basic list of boolean flags, e.g., ?features=flagA,flagB,flagC.
There was a problem hiding this comment.
You are right and I will fix that.
|
@jacobmoretti I added the basic override cases, and I inlined the spec |
| afterEach(() => { | ||
| _sandbox.restore(); | ||
| }) | ||
| it("param \"features.flag=false\" overrides LD data \"on\"", () => { |
There was a problem hiding this comment.
Minor nitpick but instead of escaping the double quotes here, lets just use single quotes or backticks.
|
@sethbattin Ok, ignore my previous comment. I just added travis-ci. So far changes look good to me, there are just lint issues right now: |
|
@jacobmoretti looks like I don't have write access, so I can't merge. If you're still good with it, would you check it off for me? |
|
@sethbattin Thanks, merged! |
This change checks
window.locationfor query parameters to override LD service data.Usage
Enabling Boolean Feature Flags
You can enable a set of boolean feature flags with a comma-delimited list in the features query parameter:
Advanced Feature Flag Overriding
If you need to temporarily set a boolean feature flag to false or override the variation reported by a multivariate feature flag, you can use features.{feature_flag} query parameters:
The values "true" and "false" are converted into true and false boolean values. If the query parameter value is omitted, then the feature flag will be reported as enabled:
Missing features
Example
This is how I tested the feature: