feat: add config.yaml support for timeouts, concurrency, persistence#79
feat: add config.yaml support for timeouts, concurrency, persistence#79
Conversation
- Add MetricsWindow (15m default) to FileConfig for CloudWatch metrics - Move lock helpers from internal/sync to internal/config - Update cloudwatch.go to use config.File().MetricsWindow()
This comment was marked as resolved.
This comment was marked as resolved.
- Fix data race in Save() by deep copying Startup.Regions slice - Extract applyStartupConfig() helper for cleaner precedence handling - Reduce GetStartup() calls from 2 to 1 Addresses PR #79 review feedback.
This comment was marked as resolved.
This comment was marked as resolved.
Pull Request Review: Config File SupportSummaryThis PR adds comprehensive configuration file support to claws, allowing users to customize timeouts, concurrency limits, CloudWatch windows, and persist profile/region selections. The implementation is well-structured with excellent test coverage (284 lines of new tests). Code Quality & Best Practices ✅Strengths:
Minor Concerns:1. Silent error handling in File() singleton (file.go:126-134) 2. Error handling in persistence Performance Considerations ⚡Config save I/O on every region/profile change Impact: Minimal for most users, but could be noticeable on slow storage. Security ✅
Consideration: Document that credentials should NEVER be added to this config (only in ~/.aws/credentials) Test Coverage 📊Excellent coverage with 284 lines covering:
Nice-to-have additions: concurrent access tests, save failure scenarios, malformed YAML handling VerdictThis is a high-quality PR that adds significant value. The code is well-structured, thread-safe, and thoroughly tested. Required changes: NoneRecommended improvements (post-merge):
Recommendation: APPROVE ✅ Great work! The atomic file writes, thread-safe design, and comprehensive test coverage demonstrate strong engineering practices. |
Summary
~/.config/claws/config.yamlsupport for customizable timeouts, concurrency limits, CloudWatch window, and startup profile/region persistenceawsInitTimeout,maxConcurrentProfileFetches) into configurableFileConfigwith thread-safe accessors--persist/--no-persistCLI flags to override config file persistence settingChanges
New Features
internal/config/file.go): YAML-based config with Duration type for human-readable timeoutsaws_init,multi_region_fetch,tag_search,metrics_loadmax_fetches(default: 50)cloudwatch.window(default: 15m)Refactoring
withRLock,doWithLock) tointernal/config/lock.gointernal/app/app.goandinternal/aws/init.goDocumentation
Testing
internal/config/file_test.goCloses #67, closes #50