cli: avoid data-dir initialization for version; create db parent dirs; redact generated passwords in CLI output

- Prevent 'nx9-wg version' from creating data directories by avoiding database initialization.
- Create parent directories when an explicit --database path is provided.
- Redact printed generated administrator passwords; announce file path or redact instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
thakaresandCopilot committed 2026-08-16 16:26:24 +05:30
commit 2ac6c81dfe
140 files changed
+31342

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
//! Error types for nx9-wg.
#[derive(Debug, thiserror::Error)]
pub enum Nx9Error {
/// Validation error
#[error("Validation error: {0}")]
Validation(String),
/// Database error
#[error("Database error: {0}")]
Database(String),
/// WireGuard error
#[error("WireGuard error: {0}")]
WireGuard(String),
/// Network error
#[error("Network error: {0}")]
Network(String),
/// Authentication error
#[error("Auth error: {0}")]
Auth(String),
/// Cryptography error
#[error("Crypto error: {0}")]
Crypto(String),
/// Backup error
#[error("Backup error: {0}")]
Backup(String),
/// Configuration error
#[error("Config error: {0}")]
Config(String),
/// I/O error
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
/// Internal error
#[error("Internal error: {0}")]
Internal(String),
}
pub type Result<T> = std::result::Result<T, Nx9Error>;