allow ollama.com to call inference and info endpoints

- By default allow ollama.com to call inference and info endpoints this can be overridden by setting an OLLAMA_HOSTS env var
This commit is contained in:
Bruce MacDonald
2024-08-09 09:31:09 -07:00
parent 5b3a21b578
commit f84cc9939c
2 changed files with 62 additions and 36 deletions

View File

@@ -57,6 +57,11 @@ func Host() *url.URL {
}
}
// HasCustomOrigins returns true if custom origins are configured. Origins can be configured via the OLLAMA_ORIGINS environment variable.
func HasCustomOrigins() bool {
return Var("OLLAMA_ORIGINS") != ""
}
// Origins returns a list of allowed origins. Origins can be configured via the OLLAMA_ORIGINS environment variable.
func Origins() (origins []string) {
if s := Var("OLLAMA_ORIGINS"); s != "" {