summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs19
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"),