[*] Update port config

This commit is contained in:
Tuyen Pham 2022-08-13 15:09:06 +07:00
parent afbf35670a
commit ee9d44fc60
2 changed files with 4 additions and 4 deletions

View File

@ -63,13 +63,13 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
let hostname: String = match (args.value_of("hostname"), &book.config.serve.hostname) { let hostname: String = match (args.value_of("hostname"), &book.config.serve.hostname) {
(Some(h), _) => h.to_owned(), (Some(h), _) => h.to_owned(),
(_, Some(h)) => h.to_owned(), (_, Some(h)) => h.to_owned(),
(_, _) => "localhost".to_owned(), (_, _) => String::from("localhost"),
}; };
let port: String = match (args.value_of("port"), &book.config.serve.port) { let port: String = match (args.value_of("port"), &book.config.serve.port) {
(Some(p), _) => p.to_owned(), (Some(p), _) => p.to_owned(),
(_, Some(p)) => p.to_owned(), (_, Some(p)) => p.to_string(),
(_, _) => "3000".to_owned(), (_, _) => 3000.to_string(),
}; };
let open_browser = args.is_present("open"); let open_browser = args.is_present("open");

View File

@ -466,7 +466,7 @@ pub struct ServeConfig {
/// Default hostname /// Default hostname
pub hostname: Option<String>, pub hostname: Option<String>,
/// Default port /// Default port
pub port: Option<String>, pub port: Option<u16>,
} }
/// Configuration for the Rust compiler(e.g., for playground) /// Configuration for the Rust compiler(e.g., for playground)