Skip to content

Commit 286a7f4

Browse files
committed
different ssl in nginx.conf.jbl
1 parent 05c5ab4 commit 286a7f4

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

backend/src/bin/load_balancer.rs

+8-12
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,7 @@ use structopt::StructOpt;
2020
use tokio;
2121

2222
#[derive(StructOpt)]
23-
struct Options {
24-
// addr: String,
25-
// /// cert file
26-
// #[structopt(short = "c", long = "cert", parse(from_os_str))]
27-
// cert: PathBuf,
28-
29-
// /// key file
30-
// #[structopt(short = "k", long = "key", parse(from_os_str))]
31-
// key: PathBuf,
32-
}
23+
struct Options {}
3324

3425
const NGINX_CONF: &str = "nginx.conf.jbl";
3526

@@ -276,7 +267,7 @@ async fn setup_nginx_config(_options: &Options) -> io::Result<JonlineServerConfi
276267
append_to_conf(&format!(
277268
"
278269
server {{
279-
listen 443 ssl;
270+
listen 443;
280271
server_name {host};
281272
ssl on;
282273
ssl_certificate {cert_file};
@@ -307,5 +298,10 @@ fn append_to_conf(content: &str) -> io::Result<()> {
307298
.append(true)
308299
.open(NGINX_CONF)
309300
.unwrap();
310-
writeln!(file, "\n{}", content)
301+
let appended_value = match content.chars().next() {
302+
Some('\n') => content.to_string(),
303+
_ => format!("\n{}", content),
304+
};
305+
306+
writeln!(file, "{}", appended_value)
311307
}

0 commit comments

Comments
 (0)