Commit 6ccda158 authored by Wohlgemuth, Jason's avatar Wohlgemuth, Jason
Browse files

feat: Update gather command to use first_env_var

parent 91138d48
Loading
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
use crate::cli::CommandOptions;
use crate::commands::preflight;
use acorn::io::api::gitlab;
use acorn::io::api::{self};
use acorn::io::api::{self, gitlab};
use acorn::param;
use acorn::prelude::PathBuf;
use clap_verbosity_flag::Verbosity;
@@ -56,7 +55,6 @@ Here is a list
async fn gitlab_example() {
    let group = "24758";
    let options = gitlab::Options::from_env();
    dbg!(&options);
    let runners = gitlab::runners(options.clone()).await;
    println!("Runners: {:#?}", runners);
    match runners {
@@ -66,7 +64,7 @@ async fn gitlab_example() {
            println!("Runner: {:#?}", gitlab::runner(options).await);
        }
        | Ok(_) => println!("Runner: Ok(None)"),
        | Err(ref why) => println!("Runner: Err({why:#?})"),
        | Err(ref why) => panic!("Runner: Err({why:#?})"),
    }
    let options = options.with_identifier(group);
    println!("Groups: {:#?}", gitlab::groups(options).await);
+2 −2
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ use crate::io::api::{DatabasePersistence, EmptyField, Endpoint, RemoteResource,
use crate::io::config::{RunnerStatus, RunnerType};
use crate::io::database::schema::{ProgrammingLanguageRow, Table};
use crate::io::database::{Database, Operations};
use crate::io::{with_progress, ApiResult, ProgressType};
use crate::io::{first_env_var, with_progress, ApiResult, ProgressType};
use crate::param;
use crate::prelude::var;
use crate::prelude::HashMap;
@@ -582,7 +582,7 @@ impl Options {
    pub fn from_env() -> Self {
        let _ = dotenvy::from_filename(".env");
        Self {
            token: var("CI_JOB_TOKEN").unwrap_or_default(),
            token: first_env_var(&["CI_JOB_TOKEN", "GITLAB_TOKEN"]).unwrap_or_default(),
            identifier: var("CI_PROJECT_ID").ok(),
            internal_identifier: var("CI_MERGE_REQUEST_IID").ok(),
            domain: var("CI_SERVER_HOST").unwrap_or_else(|_| "gitlab.com".to_string()),