Update the config format to support omitting feedback.* but not feedback.full_logs

This commit is contained in:
Graham Christensen 2018-01-20 12:40:02 -05:00
parent 76cea8c462
commit 1fb43ae09d
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
2 changed files with 12 additions and 10 deletions

View file

@ -49,18 +49,20 @@ fn main() {
let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root)); let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root));
let nix = cfg.nix(); let nix = cfg.nix();
let full_logs: bool = match cfg.feedback.full_logs {
Some(true) => true,
None => { let full_logs: bool;
match &cfg.feedback {
&Some(ref feedback) => {
full_logs = feedback.full_logs;
}
&None => {
warn!("Please define feedback.full_logs in your configuration to true or false!"); warn!("Please define feedback.full_logs in your configuration to true or false!");
warn!("feedback.full_logs when true will cause the full build log to be sent back to the server, and be viewable by everyone."); warn!("feedback.full_logs when true will cause the full build log to be sent back to the server, and be viewable by everyone.");
warn!("I strongly encourage everybody turn this on!"); warn!("I strongly encourage everybody turn this on!");
false full_logs = false;
} }
_ => { }
false
}
};
channel.basic_prefetch(1).unwrap(); channel.basic_prefetch(1).unwrap();
channel.basic_consume( channel.basic_consume(

View file

@ -14,7 +14,7 @@ use ofborg::acl;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct Config { pub struct Config {
pub runner: RunnerConfig, pub runner: RunnerConfig,
pub feedback: FeedbackConfig, pub feedback: Option<FeedbackConfig>,
pub checkout: CheckoutConfig, pub checkout: CheckoutConfig,
pub nix: NixConfig, pub nix: NixConfig,
pub rabbitmq: RabbitMQConfig, pub rabbitmq: RabbitMQConfig,
@ -23,7 +23,7 @@ pub struct Config {
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct FeedbackConfig { pub struct FeedbackConfig {
pub full_logs: Option<bool>, pub full_logs: bool,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]