add a runner.identity to the cfg

This commit is contained in:
Graham Christensen 2017-11-10 19:22:15 -05:00
parent e865b9164f
commit 76c1a342b9
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C

View file

@ -5,6 +5,7 @@ use std::io::Read;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct Config { pub struct Config {
pub runner: RunnerConfig,
pub checkout: CheckoutConfig, pub checkout: CheckoutConfig,
pub nix: NixConfig, pub nix: NixConfig,
pub rabbitmq: RabbitMQConfig, pub rabbitmq: RabbitMQConfig,
@ -24,11 +25,22 @@ pub struct NixConfig {
pub remote: String, pub remote: String,
} }
#[derive(Serialize, Deserialize, Debug)]
pub struct RunnerConfig {
pub identity: String,
}
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct CheckoutConfig { pub struct CheckoutConfig {
pub root: String, pub root: String,
} }
impl Config {
pub fn whoami(&self) -> String {
return format!("{}-{}", self.runner.identity, self.nix.system);
}
}
impl RabbitMQConfig { impl RabbitMQConfig {
pub fn as_uri(&self) -> String{ pub fn as_uri(&self) -> String{