feat: Create openfeature pull command - #75
Conversation
db4605c to
4c02198
Compare
|
For anyone interested in testing this locally: Note You also need to comment out the auth header on line 17 in |
| return map[string]any{} | ||
| default: | ||
| return nil | ||
| } |
There was a problem hiding this comment.
I love the UX here, well done 🥇
| case "flagSourceUrl": | ||
| return config.FlagSourceUrl, nil | ||
| default: | ||
| return "", fmt.Errorf("unknown key: %s", key) |
There was a problem hiding this comment.
I'm wondering if we could drop the switch statements if we take the map from unmarshal and do a key/value lookup on it.
Then maybe we could return with something like this:
value, exists := config[key]
if !exists {
return "", fmt.Errorf("unknown key: %s", key)
}
return value, nil
```
| } | ||
|
|
||
| // Loads, validates, and unmarshals the manifest file at the given path into a flagset | ||
| func Load(manifestPath string) (*flagset.Flagset, error) { |
There was a problem hiding this comment.
good call, I think moving this logic here makes sense 👍
EDIT: on second thought, I mistakenly thought this returned a Manifest obj, and I was going to use it in my branch, but it looks like it loads the manifest from path into a flagset obj.
I would expect if I call manifest.Load() it would return a manifest, just some food for thought.
Perhaps we could keep this in flagset, and I would suggest maybe naming it flagset.LoadFromManifest; or, if we keep it here, I suggest naming it manifest.LoadFlagset()
There was a problem hiding this comment.
that's a good point, the problem I had keeping it in the flagset file was a circular dependency occurring where I needed the type defined in flagset in this package, but the flagset file also imported the manifest package
I wouldn't mind renaming this to be more specific to loading the flagset though!
|
looking great to me so far 😄 |
Signed-off-by: Jason Salaber <jcsalaber@hotmail.com>
4c02198 to
1204f4f
Compare
|
Sorry @jsalaber, this automatically closed when I merged my other PR but I'm not sure why. Could you please reopen it when you have moment? |
|
@beeme1mr yep, recreating it against main |
- @angular/core 20.3.25 -> 20.3.28 (high, alert #75: XSS via event-handler attributes) - @angular/compiler 20.3.25 -> 20.3.28 (high, alert #74: XSS via event-handler attributes) - @angular/common 20.3.25 -> 20.3.28 (high, alert #73: cache-key ambiguity in HttpTransferCache) - brace-expansion 2.1.0 -> 2.1.4 (high, alert #72: DoS via exponential-time expansion) Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
* chore: resolve open dependabot security alerts - vite ^6.4.2 -> ^6.4.3 (medium/high, alerts #57 #58) - @babel/core transitive -> ^7.29.6 via override (low, alert #56) - @angular/common, @angular/core, @angular/compiler 19.x -> 20.3.25 (high/medium, alerts #52 #53 #54 #55) Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com> * chore: align @openfeature/web-sdk with angular-sdk peer dependency Address Copilot review feedback on PR #253: @openfeature/angular-sdk 1.3.1 requires @openfeature/web-sdk ^1.9.0 as a peer dependency, but package.json still allowed ^1.7.3. Bump the declared range to match and regenerate the lockfile. Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com> * chore: resolve additional dependabot alerts for fast-uri - fast-uri ^3.1.2 -> ^3.1.4 (high, alert #59: host confusion via failed IDN canonicalization) - fast-uri ^3.1.2 -> ^3.1.4 (high, alert #60: host confusion via literal backslash authority delimiter) Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com> * fix(deps): regenerate OpenAPI client for oapi-codegen v2.8.0 Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com> * chore: resolve postcss alert and pin fast-uri exactly - postcss <= 8.5.17 -> ^8.5.18 override (high, alert #62) - pin fast-uri override to exact 3.1.4 per CodeRabbit review suggestion Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com> * chore: bump fast-uri to 3.1.5 for dependabot alert #64 - fast-uri 3.1.4 -> 3.1.5 (high, alert #64: host confusion via backslash authority introducer) Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com> * chore: resolve open dependabot security alerts - @angular/core 20.3.25 -> 20.3.28 (high, alert #75: XSS via event-handler attributes) - @angular/compiler 20.3.25 -> 20.3.28 (high, alert #74: XSS via event-handler attributes) - @angular/common 20.3.25 -> 20.3.28 (high, alert #73: cache-key ambiguity in HttpTransferCache) - brace-expansion 2.1.0 -> 2.1.4 (high, alert #72: DoS via exponential-time expansion) Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com> --------- Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Summary
initcommand creates a.openfeature.yamlto storeflagSourceUrlusing the--flag-source-urlpullcommand that fetches a flag configuration from aflagSourceUrlconfigured in theinitcommandpullcommand prompts the user for default values if the source configuration doesn't define default valuesRelated Issues
#3
Notes
Loadfunction from flagset due to circular dependency when trying to useflagsettype in the manifest packageLoadFromSourceFlagstakes the type from a source configuration and compares it to different types that could match, e.g.Boolean,bool,booleanTodo
pull command