Skip to content

Commit

Permalink
feat(backend): Support running with GITLAB_API_TOKEN env var
Browse files Browse the repository at this point in the history
  • Loading branch information
sasa-tomic committed Jul 14, 2023
1 parent d0fc15b commit 8ca3b25
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rs/ic-management-backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ use ic_registry_local_registry::LocalRegistry;

const GITLAB_TOKEN_IC_PUBLIC_ENV: &str = "GITLAB_API_TOKEN_IC_PUBLIC";
const GITLAB_TOKEN_RELEASE_ENV: &str = "GITLAB_API_TOKEN_RELEASE";
const GITLAB_API_TOKEN_FALLBACK: &str = "GITLAB_API_TOKEN";

#[actix_web::main]
async fn main() -> std::io::Result<()> {
Expand Down Expand Up @@ -76,6 +77,18 @@ async fn main() -> std::io::Result<()> {
}
});

if std::env::var(GITLAB_TOKEN_RELEASE_ENV).is_err() {
std::env::set_var(
GITLAB_TOKEN_RELEASE_ENV,
std::env::var(GITLAB_API_TOKEN_FALLBACK).unwrap(),
);
}
if std::env::var(GITLAB_TOKEN_IC_PUBLIC_ENV).is_err() {
std::env::set_var(
GITLAB_TOKEN_IC_PUBLIC_ENV,
std::env::var(GITLAB_API_TOKEN_FALLBACK).unwrap(),
);
}
let registry_state = Arc::new(RwLock::new(registry::RegistryState::new(
nns_url(),
network(),
Expand Down

0 comments on commit 8ca3b25

Please sign in to comment.