orca_core/secrets/mod.rs
1mod store;
2
3pub use store::SecretStore;
4
5/// Canonical on-disk location for the secrets store: `~/.orca/secrets.json`.
6///
7/// Falls back to `./secrets.json` only if `$HOME` is unset (test/CI fallback).
8/// All CLI and server code should resolve secrets via this path so that
9/// `orca secrets set` and `orca server` always agree on a single file,
10/// regardless of the current working directory.
11pub fn default_path() -> std::path::PathBuf {
12 match std::env::var("HOME") {
13 Ok(home) => {
14 let dir = std::path::PathBuf::from(home).join(".orca");
15 let _ = std::fs::create_dir_all(&dir);
16 dir.join("secrets.json")
17 }
18 Err(_) => std::path::PathBuf::from("secrets.json"),
19 }
20}