File tree 1 file changed +8
-12
lines changed
1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -20,16 +20,7 @@ use structopt::StructOpt;
20
20
use tokio;
21
21
22
22
#[ 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 { }
33
24
34
25
const NGINX_CONF : & str = "nginx.conf.jbl" ;
35
26
@@ -276,7 +267,7 @@ async fn setup_nginx_config(_options: &Options) -> io::Result<JonlineServerConfi
276
267
append_to_conf ( & format ! (
277
268
"
278
269
server {{
279
- listen 443 ssl ;
270
+ listen 443;
280
271
server_name {host};
281
272
ssl on;
282
273
ssl_certificate {cert_file};
@@ -307,5 +298,10 @@ fn append_to_conf(content: &str) -> io::Result<()> {
307
298
. append ( true )
308
299
. open ( NGINX_CONF )
309
300
. 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)
311
307
}
You can’t perform that action at this time.
0 commit comments