Merge 9caf29a19af0fe638f484f53d3bef52ac38894ba into 67691e410db7a50b07a64858820b14de9aa91314

This commit is contained in:
Simon Frey 2024-11-14 16:14:01 +08:00 committed by GitHub
commit 5700c78944
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"log/slog"
"os"
"path/filepath"
"strings"
)
@ -34,12 +35,25 @@ func Unqualified(n Name) error {
// spot in logs.
const MissingPart = "!MISSING!"
const (
var (
defaultHost = "registry.ollama.ai"
defaultNamespace = "library"
defaultTag = "latest"
)
func init() {
// Overwrite default Host/Namespace/Tag if they are set in the env
if host := os.Getenv("REGISTRY_DEFAULT_HOST"); host != "" {
defaultHost = host
}
if namespace := os.Getenv("REGISTRY_DEFAULT_NAMESPACE"); namespace != "" {
defaultNamespace = namespace
}
if tag := os.Getenv("REGISTRY_DEFAULT_TAG"); tag != "" {
defaultTag = tag
}
}
// DefaultName returns a name with the default values for the host, namespace,
// and tag parts. The model and digest parts are empty.
//