🧹 chore: Refactor EnvVar middleware#3513
Conversation
|
""" WalkthroughThe EnvVar middleware has been updated to remove the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Middleware
participant Env
User->>Middleware: Request environment variables
alt ExportVars is empty
Middleware-->>User: Return empty set
else ExportVars specified
Middleware->>Env: Fetch specified variables
Env-->>Middleware: Return variable values
Middleware-->>User: Return specified variables
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (9)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
This PR changes the EnvVar middleware default behavior to return no variables unless explicitly exported, removes the old ExcludeVars option, updates tests to expect no leakage of environment variables by default, and updates documentation accordingly.
- Remove
ExcludeVarsfrom code and docs - Make
newEnvVarreturn an empty set on default Config - Update tests and docs to reflect that no env vars are exported by default
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| middleware/envvar/envvar.go | Dropped ExcludeVars logic and ensure no env vars are returned by default |
| middleware/envvar/envvar_test.go | Updated tests to assert absence of vars when no ExportVars set |
| docs/whats_new.md | Documented removal of ExcludeVars and new ExportVars-only model |
| docs/middleware/envvar.md | Clarified default behavior (no exports) and removed ExcludeVars references |
Comments suppressed due to low confidence (2)
middleware/envvar/envvar.go:11
- [nitpick] The doc comment is missing a verb; consider changing to
// ExportVars specifies the environment variables that should be exportedfor clarity.
// ExportVars specifies the environment variables that should export
docs/middleware/envvar.md:62
- The JSON response uses the field
vars, notExportVars. Update this table row to reflect the actualvarsproperty name.
| ExportVars | `map[string]string` | ExportVars specifies the environment variables that should be exported. | `nil` |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3513 +/- ##
==========================================
- Coverage 83.88% 83.87% -0.01%
==========================================
Files 120 120
Lines 12278 12275 -3
==========================================
- Hits 10299 10296 -3
Misses 1555 1555
Partials 424 424
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary:
EnvVarmiddleware with default settings.