This commit is contained in:
@@ -164,15 +164,33 @@ fn default_organization_format() -> String {
|
||||
"{artist}/{album}/{track_number} - {title}.{ext}".to_string()
|
||||
}
|
||||
|
||||
fn default_port() -> u16 { 8085 }
|
||||
fn default_bind() -> String { "0.0.0.0".to_string() }
|
||||
fn default_confidence() -> f64 { 0.8 }
|
||||
fn default_format() -> String { "opus".to_string() }
|
||||
fn default_search_source() -> String { "ytmusic".to_string() }
|
||||
fn default_true() -> bool { true }
|
||||
fn default_rate_limit() -> u32 { 450 }
|
||||
fn default_rate_limit_auth() -> u32 { 1800 }
|
||||
fn default_concurrency() -> usize { 4 }
|
||||
fn default_port() -> u16 {
|
||||
8085
|
||||
}
|
||||
fn default_bind() -> String {
|
||||
"0.0.0.0".to_string()
|
||||
}
|
||||
fn default_confidence() -> f64 {
|
||||
0.8
|
||||
}
|
||||
fn default_format() -> String {
|
||||
"opus".to_string()
|
||||
}
|
||||
fn default_search_source() -> String {
|
||||
"ytmusic".to_string()
|
||||
}
|
||||
fn default_true() -> bool {
|
||||
true
|
||||
}
|
||||
fn default_rate_limit() -> u32 {
|
||||
450
|
||||
}
|
||||
fn default_rate_limit_auth() -> u32 {
|
||||
1800
|
||||
}
|
||||
fn default_concurrency() -> usize {
|
||||
4
|
||||
}
|
||||
|
||||
// --- Loading and Saving ---
|
||||
|
||||
@@ -223,8 +241,8 @@ impl AppConfig {
|
||||
std::fs::create_dir_all(parent)
|
||||
.map_err(|e| format!("failed to create config directory: {e}"))?;
|
||||
}
|
||||
let yaml = serde_yaml::to_string(self)
|
||||
.map_err(|e| format!("failed to serialize config: {e}"))?;
|
||||
let yaml =
|
||||
serde_yaml::to_string(self).map_err(|e| format!("failed to serialize config: {e}"))?;
|
||||
std::fs::write(&config_path, yaml)
|
||||
.map_err(|e| format!("failed to write config to {}: {e}", config_path.display()))?;
|
||||
tracing::info!(path = %config_path.display(), "config saved");
|
||||
@@ -241,10 +259,10 @@ impl AppConfig {
|
||||
if let Ok(v) = std::env::var("SHANTY_DOWNLOAD_PATH") {
|
||||
config.download_path = PathBuf::from(v);
|
||||
}
|
||||
if let Ok(v) = std::env::var("SHANTY_WEB_PORT") {
|
||||
if let Ok(port) = v.parse() {
|
||||
config.web.port = port;
|
||||
}
|
||||
if let Ok(v) = std::env::var("SHANTY_WEB_PORT")
|
||||
&& let Ok(port) = v.parse()
|
||||
{
|
||||
config.web.port = port;
|
||||
}
|
||||
if let Ok(v) = std::env::var("SHANTY_WEB_BIND") {
|
||||
config.web.bind = v;
|
||||
|
||||
Reference in New Issue
Block a user