poc-memory: load AppConfig at startup
admin load-context (and any subcommand that reaches config::app()) panicked with "config::app() called before load_app()" because the poc-memory binary never initialized the global AppConfig. The main consciousness binary loads it via load_session; poc-memory never did. Load with default CliArgs before dispatch — figment still pulls from ~/.consciousness/config.json5 and env the same way. Bail on error instead of limping: a broken config means paths like memory_root are wrong and the tool will misbehave silently. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
204ba5570a
commit
6f20e68865
1 changed files with 8 additions and 0 deletions
|
|
@ -482,6 +482,14 @@ async fn main() {
|
||||||
|
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
|
// Some subcommands (e.g. admin load-context) read from the global
|
||||||
|
// AppConfig. poc-memory has no config CLI flags of its own, so load
|
||||||
|
// with defaults — figment still pulls from ~/.consciousness/config.json5
|
||||||
|
// and env the same way.
|
||||||
|
if let Err(e) = crate::config::load_app(&crate::user::CliArgs::default()) {
|
||||||
|
eprintln!("warning: failed to load config: {:#}", e);
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(e) = cli.command.run().await {
|
if let Err(e) = cli.command.run().await {
|
||||||
eprintln!("Error: {}", e);
|
eprintln!("Error: {}", e);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue