Renamed key to token in config file and added config.json.example
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
279551eb54
commit
2447a01145
12
config.json.example
Normal file
12
config.json.example
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"host": "gitlab host",
|
||||||
|
"token": "gitlab token",
|
||||||
|
"projects": [
|
||||||
|
{
|
||||||
|
"name": "lovallat/lovallat",
|
||||||
|
"ref_": "master",
|
||||||
|
"abs_x": 0,
|
||||||
|
"abs_y": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -8,7 +8,7 @@ const CONFIG_FILENAME: &str = "./config.json";
|
|||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub host: String,
|
pub host: String,
|
||||||
pub key: String,
|
pub token: String,
|
||||||
pub projects: Vec<Project>
|
pub projects: Vec<Project>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ pub fn load_from_config(config: Config) -> Vec<JoinHandle<()>> {
|
|||||||
info!("Loading gitlab manager from configuration.");
|
info!("Loading gitlab manager from configuration.");
|
||||||
let mut threads = vec![];
|
let mut threads = vec![];
|
||||||
for p in config.projects.iter() {
|
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();
|
let project = p.clone();
|
||||||
threads.push(thread::spawn(move|| refresh_on_timer(client, project)));
|
threads.push(thread::spawn(move|| refresh_on_timer(client, project)));
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ fn running_thread(config: Config) {
|
|||||||
let project = project.unwrap();
|
let project = project.unwrap();
|
||||||
if restart {
|
if restart {
|
||||||
restart = false;
|
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);
|
disengage_restart(&mut output);
|
||||||
} else {
|
} else {
|
||||||
open::that_in_background(format!("https://{}/{}", config.host, project.name));
|
open::that_in_background(format!("https://{}/{}", config.host, project.name));
|
||||||
|
@ -13,7 +13,7 @@ fn main() {
|
|||||||
if conf.is_none() {
|
if conf.is_none() {
|
||||||
config_manager::save_config(&Config {
|
config_manager::save_config(&Config {
|
||||||
host: "gitlab-host".to_string(),
|
host: "gitlab-host".to_string(),
|
||||||
key: "your-gitlab-key".to_string(),
|
token: "your-gitlab-key".to_string(),
|
||||||
projects: vec![Project {
|
projects: vec![Project {
|
||||||
name: "example".to_string(),
|
name: "example".to_string(),
|
||||||
ref_: "master".to_string(),
|
ref_: "master".to_string(),
|
||||||
|
Loading…
Reference in New Issue
Block a user