Skip to content

Commit dac0763

Browse files
committed
fix: add option to allow http for local registry
1 parent e574519 commit dac0763

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

env_common/src/logic/api_oci_registry.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ impl OCIRegistryProvider {
123123
}
124124

125125
fn get_client_auth(&self) -> (Client, RegistryAuth) {
126+
let protocol = if std::env::var("OCI_REGISTRY_ALLOW_HTTP").is_ok() {
127+
oci_client::client::ClientProtocol::Http
128+
} else {
129+
oci_client::client::ClientProtocol::Https
130+
};
131+
132+
let config = oci_client::client::ClientConfig {
133+
protocol,
134+
..Default::default()
135+
};
136+
let client = Client::new(config);
126137
let auth = match &self.username {
127138
None => RegistryAuth::Anonymous,
128139
Some(username) => {
@@ -132,6 +143,6 @@ impl OCIRegistryProvider {
132143
RegistryAuth::Basic(username.clone(), self.password.clone().unwrap())
133144
}
134145
};
135-
(Client::default(), auth)
146+
(client, auth)
136147
}
137148
}

0 commit comments

Comments
 (0)