From 2447a011457971cbb7705e3049b7d9717a0a518c Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Fri, 3 Jun 2022 08:53:29 +0200 Subject: [PATCH] Renamed key to token in config file and added config.json.example Signed-off-by: Louis Vallat --- config.json.example | 12 ++++++++++++ src/config_manager.rs | 2 +- src/gitlab_controller.rs | 2 +- src/launchpad_controller.rs | 2 +- src/main.rs | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 config.json.example diff --git a/config.json.example b/config.json.example new file mode 100644 index 0000000..1435d53 --- /dev/null +++ b/config.json.example @@ -0,0 +1,12 @@ +{ + "host": "gitlab host", + "token": "gitlab token", + "projects": [ + { + "name": "lovallat/lovallat", + "ref_": "master", + "abs_x": 0, + "abs_y": 0 + } + ] +} diff --git a/src/config_manager.rs b/src/config_manager.rs index a243c54..33466f2 100644 --- a/src/config_manager.rs +++ b/src/config_manager.rs @@ -8,7 +8,7 @@ const CONFIG_FILENAME: &str = "./config.json"; #[derive(Clone, Deserialize, Serialize)] pub struct Config { pub host: String, - pub key: String, + pub token: String, pub projects: Vec } diff --git a/src/gitlab_controller.rs b/src/gitlab_controller.rs index decadf3..2799e31 100644 --- a/src/gitlab_controller.rs +++ b/src/gitlab_controller.rs @@ -78,7 +78,7 @@ pub fn load_from_config(config: Config) -> Vec> { info!("Loading gitlab manager from configuration."); let mut threads = vec![]; for p in config.projects.iter() { - let client = Gitlab::new(config.host.as_str(), config.key.as_str()).unwrap(); + let client = Gitlab::new(config.host.as_str(), config.token.as_str()).unwrap(); let project = p.clone(); threads.push(thread::spawn(move|| refresh_on_timer(client, project))); } diff --git a/src/launchpad_controller.rs b/src/launchpad_controller.rs index 1533537..39080d6 100644 --- a/src/launchpad_controller.rs +++ b/src/launchpad_controller.rs @@ -33,7 +33,7 @@ fn running_thread(config: Config) { let project = project.unwrap(); if restart { restart = false; - retry_pipeline(config.host.as_str(), config.key.as_str(), project); + retry_pipeline(config.host.as_str(), config.token.as_str(), project); disengage_restart(&mut output); } else { open::that_in_background(format!("https://{}/{}", config.host, project.name)); diff --git a/src/main.rs b/src/main.rs index 6a18159..83debbb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ fn main() { if conf.is_none() { config_manager::save_config(&Config { host: "gitlab-host".to_string(), - key: "your-gitlab-key".to_string(), + token: "your-gitlab-key".to_string(), projects: vec![Project { name: "example".to_string(), ref_: "master".to_string(),