From 4a10e7a7faff88bd3245d89a5f2def5e863991c0 Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Thu, 15 Feb 2024 13:46:56 -0800 Subject: [PATCH] Harden the OLLAMA_HOST lookup for quotes --- cmd/cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index 66909c2c..768f4afb 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -685,7 +685,7 @@ func generate(cmd *cobra.Command, opts runOptions) error { } func RunServer(cmd *cobra.Command, _ []string) error { - host, port, err := net.SplitHostPort(os.Getenv("OLLAMA_HOST")) + host, port, err := net.SplitHostPort(strings.Trim(os.Getenv("OLLAMA_HOST"), "\"'")) if err != nil { host, port = "127.0.0.1", "11434" if ip := net.ParseIP(strings.Trim(os.Getenv("OLLAMA_HOST"), "[]")); ip != nil {