GetRegistryAddress (registry/auth.go)

arcane · backend/pkg/registry/auth.go · go · BSD-3-Clause
infra

Module exposing: GetRegistryAddress, ExtractRegistryHost, SplitRegistryURL, NormalizeRegistryURL, EncodeAuthHeader, DecodeAuthHeader

// Source: https://github.com/getarcaneapp/arcane | License: BSD-3-Clause | Copyright 2025, Kyle Mendell
// Provided via justclaw.it.com; keep this notice with the code.
package registry

import (
	"fmt"
	"strings"

	ref "github.com/distribution/reference"
	dockerauthconfig "github.com/moby/moby/api/pkg/authconfig"
	dockerregistry "github.com/moby/moby/api/types/registry"

	"kit.getarcane.app"
)

func GetRegistryAddress(imageRef string) (string, error) {
	named, err := ref.ParseNormalizedNamed(imageRef)
	if err != nil {
		return "", err
	}
	addr := ref.Domain(named)
	return kit.Ternary(addr == DefaultRegistryDomain, DefaultRegistryHost, addr), nil
}

func ExtractRegistryHost(imageRef string) string {
	if i := strings.IndexByte(imageRef, '@'); i != -1 {
		imageRef = imageRef[:i]
	}

	hostCa

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key