Some checks failed
Secrets v3 CI / 检查 (push) Has been cancelled
- Add apps/api, desktop Tauri shell, domain/application/crypto/device-auth/infrastructure-db - Replace desktop-daemon vault integration; drop secrets-core and secrets-mcp* - Ignore apps/desktop/dist and generated Tauri icons; document icon/dist steps in AGENTS.md - Apply rustfmt; fix clippy (collapsible_if, HTTP method as str)
24 lines
634 B
Rust
24 lines
634 B
Rust
use anyhow::Result;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct DaemonConfig {
|
|
pub bind: String,
|
|
}
|
|
|
|
pub fn load_config() -> Result<DaemonConfig> {
|
|
let bind =
|
|
std::env::var("SECRETS_DAEMON_BIND").unwrap_or_else(|_| "127.0.0.1:9515".to_string());
|
|
if bind.trim().is_empty() {
|
|
anyhow::bail!("SECRETS_DAEMON_BIND must not be empty");
|
|
}
|
|
Ok(DaemonConfig { bind })
|
|
}
|
|
|
|
pub fn load_persisted_device_token() -> Result<Option<String>> {
|
|
let token = std::env::var("SECRETS_DEVICE_LOGIN_TOKEN")
|
|
.ok()
|
|
.map(|value| value.trim().to_string())
|
|
.filter(|value| !value.is_empty());
|
|
Ok(token)
|
|
}
|