Skip to content

Commit

Permalink
Handle banner display in the configuration file.
Browse files Browse the repository at this point in the history
Please @CephalonRho add show_banner in your configuration file
  • Loading branch information
Clint.Network committed Feb 1, 2020
1 parent 6944a16 commit 6e24159
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl Default for Configuration {
use_ssl: true,
ssl_certificate: String::new(),
ssl_certificate_key: String::new(),
show_banner: true
},
authentication: Authentication {
enabled: false,
Expand Down Expand Up @@ -71,6 +72,7 @@ pub struct General {
pub use_ssl: bool,
pub ssl_certificate: String,
pub ssl_certificate_key: String,
pub show_banner: bool
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ async fn main() -> Result<(), Error> {
Err(e) => return Err(Error::ParseCli { source: e }),
};

if !matches.is_present("no-banner") {
println!("{}", BANNER);
}

let config_path = {
if let Some(config) = matches.value_of("config") {
Path::new(config).to_path_buf()
Expand All @@ -108,6 +104,10 @@ async fn main() -> Result<(), Error> {
Configuration::default()
};

if !matches.is_present("no-banner") && config.general.show_banner {
println!("{}", BANNER);
}

let logging_colors = ColoredLevelConfig::new()
.debug(Color::BrightMagenta)
.warn(Color::BrightYellow)
Expand Down

0 comments on commit 6e24159

Please sign in to comment.