Skip to content

Commit 5221bdc

Browse files
vados-cosmonicthomastaylor312
authored andcommitted
feat: support specifying OCI namespace details on RegistryMetadata
This commit adds support for specifying OCI namespace details on a `RegistryMetadata` and avoiding introducing the feature as a breaking change by utilizing an opt-in feature. Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
1 parent ca95d2b commit 5221bdc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

crates/wasm-pkg-common/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ readme = "../../README.md"
1111
[features]
1212
metadata-client = ["dep:reqwest"]
1313
tokio = ["tokio/io-util"]
14+
# Extra features to facilitate making working with OCI images easier
15+
oci_extras = []
1416

1517
[dependencies]
1618
anyhow = { workspace = true }

crates/wasm-pkg-common/src/metadata.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ pub struct RegistryMetadata {
2626
/// OCI Registry
2727
#[serde(skip_serializing)]
2828
oci_registry: Option<String>,
29+
2930
/// OCI Namespace Prefix
3031
#[serde(skip_serializing)]
3132
oci_namespace_prefix: Option<String>,
33+
3234
/// Warg URL
3335
#[serde(skip_serializing)]
3436
warg_url: Option<String>,
@@ -109,6 +111,18 @@ impl RegistryMetadata {
109111
.map_err(|err| Error::InvalidRegistryMetadata(err.into()))?,
110112
))
111113
}
114+
115+
/// Set the OCI registry
116+
#[cfg(feature = "oci_extras")]
117+
pub fn set_oci_registry(&mut self, registry: Option<String>) {
118+
self.oci_registry = registry;
119+
}
120+
121+
/// Set the OCI namespace prefix
122+
#[cfg(feature = "oci_extras")]
123+
pub fn set_oci_namespace_prefix(&mut self, ns_prefix: Option<String>) {
124+
self.oci_namespace_prefix = ns_prefix;
125+
}
112126
}
113127

114128
#[cfg(feature = "metadata-client")]

0 commit comments

Comments
 (0)