Update Fedimint configuration and enhance onboarding process
- Upgraded Fedimint version to v0.10.0 in docker-compose.yml and manifest.yml, adding support for the built-in Guardian UI. - Modified .gitignore to exclude deploy-config.sh script. - Enhanced onboarding process in AuthManager to persist onboarding state and validate password strength during user setup. - Updated API to handle onboarding completion and password change requests, ensuring a smoother user experience. - Improved configuration management to support Nostr discovery and Tor proxy settings, enhancing node identity features.
This commit is contained in:
@@ -45,15 +45,40 @@ pub struct Config {
|
||||
pub bind_host: String,
|
||||
pub bind_port: u16,
|
||||
pub log_level: String,
|
||||
/// Host IP for container env vars (FM_API_URL, BACKEND_MAINNET_HTTP_HOST, etc.)
|
||||
pub host_ip: String,
|
||||
// Dev mode configuration
|
||||
pub dev_mode: bool,
|
||||
pub container_runtime: ContainerRuntime,
|
||||
pub port_offset: u16,
|
||||
pub bitcoin_simulation: BitcoinSimulation,
|
||||
pub dev_data_dir: PathBuf,
|
||||
/// Nostr discovery: opt-in only. When true + relays non-empty, publish node to relays.
|
||||
#[serde(default)]
|
||||
pub nostr_discovery_enabled: bool,
|
||||
/// Nostr relay URLs (comma-separated). Only used when nostr_discovery_enabled.
|
||||
#[serde(default)]
|
||||
pub nostr_relays: Vec<String>,
|
||||
/// Tor SOCKS5 proxy (e.g. 127.0.0.1:9050). When set, ALL Nostr traffic routes through Tor.
|
||||
#[serde(default)]
|
||||
pub nostr_tor_proxy: Option<String>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
/// Detect primary host IP (first non-loopback IPv4)
|
||||
fn detect_host_ip() -> Result<String> {
|
||||
let output = std::process::Command::new("hostname")
|
||||
.args(["-I"])
|
||||
.output()
|
||||
.context("Failed to run hostname -I")?;
|
||||
let s = String::from_utf8_lossy(&output.stdout);
|
||||
let ip = s
|
||||
.split_whitespace()
|
||||
.find(|s| !s.starts_with("127.") && s.contains('.'))
|
||||
.unwrap_or("127.0.0.1");
|
||||
Ok(ip.to_string())
|
||||
}
|
||||
|
||||
pub async fn load() -> Result<Self> {
|
||||
// Default configuration
|
||||
let mut config = Self::default();
|
||||
@@ -124,6 +149,29 @@ impl Config {
|
||||
config.dev_data_dir = PathBuf::from(dev_data_dir);
|
||||
}
|
||||
|
||||
// Nostr discovery (opt-in, secure by default)
|
||||
if let Ok(v) = std::env::var("ARCHIPELAGO_NOSTR_DISCOVERY_ENABLED") {
|
||||
config.nostr_discovery_enabled = v.parse().unwrap_or(false);
|
||||
}
|
||||
if let Ok(v) = std::env::var("ARCHIPELAGO_NOSTR_RELAYS") {
|
||||
config.nostr_relays = v
|
||||
.split(',')
|
||||
.map(|s| s.trim().to_string())
|
||||
.filter(|s| !s.is_empty())
|
||||
.collect();
|
||||
}
|
||||
if let Ok(v) = std::env::var("ARCHIPELAGO_NOSTR_TOR_PROXY") {
|
||||
let s = v.trim().to_string();
|
||||
config.nostr_tor_proxy = if s.is_empty() { None } else { Some(s) };
|
||||
}
|
||||
|
||||
// Host IP for container env vars (detect if not set)
|
||||
if let Ok(ip) = std::env::var("ARCHIPELAGO_HOST_IP") {
|
||||
config.host_ip = ip;
|
||||
} else {
|
||||
config.host_ip = Self::detect_host_ip().unwrap_or_else(|_| "127.0.0.1".to_string());
|
||||
}
|
||||
|
||||
// Ensure data directory exists
|
||||
fs::create_dir_all(&config.data_dir).await
|
||||
.context("Failed to create data directory")?;
|
||||
@@ -145,11 +193,18 @@ impl Default for Config {
|
||||
bind_host: "0.0.0.0".to_string(),
|
||||
bind_port: 5678,
|
||||
log_level: "info".to_string(),
|
||||
host_ip: "127.0.0.1".to_string(),
|
||||
dev_mode: false,
|
||||
container_runtime: ContainerRuntime::Auto,
|
||||
port_offset: 10000,
|
||||
bitcoin_simulation: BitcoinSimulation::Mock,
|
||||
dev_data_dir: PathBuf::from("/tmp/archipelago-dev"),
|
||||
nostr_discovery_enabled: true,
|
||||
nostr_relays: vec![
|
||||
"wss://relay.damus.io".into(),
|
||||
"wss://relay.nostr.info".into(),
|
||||
],
|
||||
nostr_tor_proxy: Some("127.0.0.1:9050".into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user