Skip to content

Commit

Permalink
Make it possible to override bind address with -b
Browse files Browse the repository at this point in the history
Make it possible to override the bind address with `-b 127.0.0.1`, for
example. In some cases it may not be desirable to open the port to the
public internet. Leaves the default unchanged.
  • Loading branch information
laanwj authored and ibz committed Sep 2, 2024
1 parent a23f9fc commit 766a429
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ struct Cli {
#[clap(long)]
ssl_acme_production: bool,

#[clap(short('b'), long)]
bind: Option<String>,

#[clap(short('p'), long)]
port: Option<u32>,
}
Expand Down Expand Up @@ -684,7 +687,7 @@ async fn main() -> Result<(), std::io::Error> {
.post(handle_post_site)
.get(handle_get_sites);

let addr = "0.0.0.0";
let addr = args.bind.unwrap_or("0.0.0.0".to_owned());

if args.ssl_cert.is_some() && args.ssl_key.is_some() {
let port = args.port.unwrap_or(443);
Expand Down

0 comments on commit 766a429

Please sign in to comment.