-
Notifications
You must be signed in to change notification settings - Fork 0
Add cache of configuration #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ce21e3e to
510bae9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a caching mechanism for the user configuration and refactors logging setup across commands. Key changes include:
- Adding a debug log to track resource session openings in highlevel/connect.go.
- Refactoring slog logging configuration in cmd/fhome/main.go based on environment variables and CLI flags.
- Replacing synchronous client creation with a cached approach in cmd/fhome/commands.go and adding a new caching implementation in cmd/fhome/cache.go.
Reviewed Changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| highlevel/connect.go | Updated comment and added a debug log when opening a resource session |
| cmd/fhome/main.go | Revised logger configuration to use environment and command-line flags |
| cmd/fhome/commands.go | Updated ShellComplete to use the new getUserConfig function |
| cmd/fhome/cache.go | Added new caching logic for user configuration with background updates |
Files not reviewed (2)
- .idea/dictionaries/project.xml: Language not supported
- .idea/inspectionProfiles/Project_Default.xml: Language not supported
Comments suppressed due to low confidence (1)
cmd/fhome/commands.go:323
- Using panic for error handling in ShellComplete may abruptly terminate the CLI process; consider handling the error gracefully instead.
if err != nil { panic(err) }
| slog.String("type", myResources.ResourceType0), | ||
| ) | ||
|
|
||
| slog.Debug("opening client to resource session") |
Copilot
AI
Apr 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider including additional context details (e.g., resource identifiers) in the debug log to aid troubleshooting.
| slog.Debug("opening client to resource session") | |
| slog.Debug("opening client to resource session", slog.String("resourcePassword", config.ResourcePassword)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XDD
fix #37