feat(server): add --config override for server config path#601
feat(server): add --config override for server config path#601TimeToBuildBob wants to merge 2 commits into
Conversation
Greptile SummaryThis PR adds a
Confidence Score: 5/5Safe to merge — the new --config flag is wired correctly through clap and the config-loading path, and the two new tests are properly serialised against the shared TESTING global. The core logic change is small and correct: get_config_path delegates to the override when one is present and falls back to the existing testing/production path otherwise. Parent-directory creation is handled uniformly. The only remarks are in the test module (a now-redundant create_dir_all call and a mutex-poisoning edge case on test panic), neither of which affects production behaviour. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[aw-server starts] --> B{--config flag provided?}
B -- Yes --> C[Use override path as-is]
B -- No --> D{--testing mode?}
D -- Yes --> E[config-testing.toml in config dir]
D -- No --> F[config.toml in config dir]
C --> G[create_dir_all for parent]
E --> H[create_dir_all for parent]
F --> H
G --> I{File exists?}
H --> I
I -- No --> J[Write commented-out default config]
J --> K[Read & parse TOML]
I -- Yes --> K
K --> L[Return AWConfig]
L --> M[Apply CLI overrides: --host, --port, etc.]
Reviews (2): Last reviewed commit: "test(server): isolate config override te..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #601 +/- ##
==========================================
+ Coverage 70.81% 76.48% +5.66%
==========================================
Files 51 61 +10
Lines 2916 4809 +1893
==========================================
+ Hits 2065 3678 +1613
- Misses 851 1131 +280 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TimeToBuildBob
left a comment
There was a problem hiding this comment.
This change doesnt actually fix a bug — the existing code on line 118 already guards against a missing "tasks" key with .get("tasks", {}).
More importantly, after extracting tasks = timeout_config.get("tasks", {}), the subsequent lookup should use tasks[task_id] instead of repeating timeout_config["tasks"][task_id]. Otherwise the extraction is pointless and the code is inconsistent.
If the goal is cleaner/defensive code, use tasks[task_id] on line 119.
|
CI is green and the Greptile threads are resolved on |
Summary
-c/--configtoaw-serverCloses #593.
Verification
cargo test -p aw-server create_config_cargo run -p aw-server --bin aw-server -- --help | rg -n "config|dbpath|webpath"