diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2026-02-07 16:00:46 +0100 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2026-02-07 16:00:46 +0100 |
| commit | 9f2b31f58fa4e3664e7ec1362fbcfc3b7e0dc35e (patch) | |
| tree | a9402167f21dda2add8a28a7e69e77fb7cc2fddf /src/main.rs | |
| parent | dc003d2ca7da471021f9bed6ddc481b0a79cd890 (diff) | |
Add support for anonymous auth
We need this to actually run the integration tests. With that said,
please don't run the integration tests unless you need to. It's not nice
to use other peoples infrastructure for tests.
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 4f42d45..0d08fc6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use crate::docker::DockerRef; use crate::manifest::ManifestFile; use crate::dockerfile::DockerfileFile; use crate::db::{Db, SqliteDb}; -use crate::registry::{Registry, HttpRegistry, AuthInfo, basic_auth}; +use crate::registry::{Registry, HttpRegistry, AuthInfo, Credentials, basic_auth}; use rand::distr::{Alphanumeric, SampleString}; use std::ops::Range; @@ -27,6 +27,7 @@ Search FILE for docker images and suggest updates Options: --auth <REGISTRY> <USER> <PASS> Authenticate against REGISTRY (repeatable) +--anonymous-auth <REGISTRY> Access REGISTRY anonymously (repeatable) --config <PATH> Read config from PATH --scratch <DIR> Store temporary files in DIR --metrics-port <PORT> Serve Prometheus metrics on PORT (default: disabled)", @@ -473,7 +474,7 @@ fn main() { if let Some(registry) = it.next() && let Some(username) = it.next() && let Some(password) = it.next() { auths.push(AuthInfo { host: registry.clone(), - auth: basic_auth(username, password), + credentials: Credentials::Basic(basic_auth(username, password)), }); } else { println!("Error: --auth requires three parameters"); @@ -481,6 +482,18 @@ fn main() { std::process::exit(1); } }, + Some("--anonymous-auth") => { + if let Some(registry) = it.next() { + auths.push(AuthInfo { + host: registry.clone(), + credentials: Credentials::Anonymous, + }); + } else { + println!("Error: --anonymous-auth requires a registry parameter"); + help(cmd); + std::process::exit(1); + } + }, Some("--config") => { if let Some(path) = it.next() { config_path = Some(std::path::PathBuf::from(path)); @@ -600,7 +613,7 @@ fn main() { Ok(json_event_parser::JsonEvent::String(v)) => { auths.push(AuthInfo { host: key, - auth: v.into_owned(), + credentials: Credentials::Basic(v.into_owned()), }); }, _ => panic!("Invalid config json"), |
