Commit 553c8844 authored by Jeffrey Morgan's avatar Jeffrey Morgan
Browse files

allow specifying server host and port with `OLLAMA_HOST` and `OLLAMA_PORT`

parent b245f5af
...@@ -153,7 +153,17 @@ func generateBatch(model string) error { ...@@ -153,7 +153,17 @@ func generateBatch(model string) error {
} }
func RunServer(_ *cobra.Command, _ []string) error { func RunServer(_ *cobra.Command, _ []string) error {
ln, err := net.Listen("tcp", "127.0.0.1:11434") host := os.Getenv("OLLAMA_HOST")
if host == "" {
host = "127.0.0.1"
}
port := os.Getenv("OLLAMA_PORT")
if port == "" {
port = "11434"
}
ln, err := net.Listen("tcp", fmt.Sprintf("%s:%s", host, port))
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment