From 1fb43ae09d3e2320c7421e069ec945e61fa52aa6 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 20 Jan 2018 12:40:02 -0500 Subject: [PATCH] Update the config format to support omitting feedback.* but not feedback.full_logs --- ofborg/src/bin/builder.rs | 18 ++++++++++-------- ofborg/src/config.rs | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ofborg/src/bin/builder.rs b/ofborg/src/bin/builder.rs index 63bc3d5..0a7576b 100644 --- a/ofborg/src/bin/builder.rs +++ b/ofborg/src/bin/builder.rs @@ -49,18 +49,20 @@ fn main() { let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root)); 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!("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!"); - false + full_logs = false; } - _ => { - false - } - }; + } channel.basic_prefetch(1).unwrap(); channel.basic_consume( diff --git a/ofborg/src/config.rs b/ofborg/src/config.rs index e31524b..1a6e2b5 100644 --- a/ofborg/src/config.rs +++ b/ofborg/src/config.rs @@ -14,7 +14,7 @@ use ofborg::acl; #[derive(Serialize, Deserialize, Debug)] pub struct Config { pub runner: RunnerConfig, - pub feedback: FeedbackConfig, + pub feedback: Option, pub checkout: CheckoutConfig, pub nix: NixConfig, pub rabbitmq: RabbitMQConfig, @@ -23,7 +23,7 @@ pub struct Config { #[derive(Serialize, Deserialize, Debug)] pub struct FeedbackConfig { - pub full_logs: Option, + pub full_logs: bool, } #[derive(Serialize, Deserialize, Debug)]