mirror of
https://github.com/imjasonh/krust
synced 2026-07-11 07:59:54 +00:00
feat: Add RegistryAuth::from_default() convenience methods
- Add from_default() and from_default_str() methods to RegistryAuth - These methods automatically resolve auth from Docker config and credential helpers - Update example to demonstrate both explicit and auto auth approaches - Simplify krust's auth wrapper to use the new convenience method - Fix test environment variable pollution 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a6ae83c3b2
commit
672ada3dd2
9 changed files with 148 additions and 239 deletions
|
|
@ -1,11 +1,10 @@
|
|||
//! Simple authentication wrapper using oci-distribution's credential helper
|
||||
|
||||
use anyhow::Result;
|
||||
use oci_distribution::credential_helper::resolve_docker_auth;
|
||||
use oci_distribution::secrets::RegistryAuth;
|
||||
|
||||
/// Resolve authentication for a given resource using Docker config and credential helpers
|
||||
pub fn resolve_auth(resource: &str) -> Result<RegistryAuth> {
|
||||
resolve_docker_auth(resource)
|
||||
RegistryAuth::from_default_str(resource)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to resolve auth: {}", e))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue