feature/upstream-service #13

Merged
GW_MC merged 43 commits from feature/upstream-service into master 2026-01-01 10:49:32 +08:00
Showing only changes of commit a0b4df745e - Show all commits

View File

@@ -54,13 +54,13 @@ impl NginxConfigProvider for UpstreamInfo {
.iter()
.map(|target| target.to_nginx_config(Some(indent.unwrap_or(0) + INDENT_SIZE)))
.collect();
format!(
"upstream {} {{\n{}\n}}",
self.name,
targets_config.join("\n".indent(indent.unwrap_or(0) + INDENT_SIZE).as_str())
)
.indent(indent.unwrap_or(0))
let targets_config_str = if targets_config.is_empty() {
"server 127.0.0.1:65535 down; # placeholder target".to_string()
} else {
targets_config.join("\n")
}
.indent(indent.unwrap_or(0) + INDENT_SIZE);
format!("upstream {} {{\n{}\n}}", self.name, targets_config_str).indent(indent.unwrap_or(0))
}
}