Move the default configuration to the config file
This commit is contained in:
parent
81a50a237d
commit
2ae5270d5e
2 changed files with 7 additions and 3 deletions
|
@ -20,7 +20,11 @@ pub fn get_config(file_path: &str) -> Config {
|
|||
Err(_) =>
|
||||
// No config file
|
||||
{
|
||||
Config::default()
|
||||
Config {
|
||||
scheme: Some("http".to_string()),
|
||||
port: Some(8080),
|
||||
..Config::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ mod portfolio;
|
|||
async fn main() -> io::Result<()> {
|
||||
let config = config::get_config("./config/config.toml");
|
||||
|
||||
let addr = ("127.0.0.1", config.port.unwrap_or(8080));
|
||||
let addr = ("127.0.0.1", config.port.unwrap());
|
||||
|
||||
println!(
|
||||
"Listening to {}://{}:{}",
|
||||
config.clone().scheme.unwrap_or("http".to_string()),
|
||||
config.clone().scheme.unwrap(),
|
||||
addr.0,
|
||||
addr.1
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue