mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-10 07:46:59 +00:00
allow specifying server host and port with OLLAMA_HOST and OLLAMA_PORT
This commit is contained in:
12
cmd/cmd.go
12
cmd/cmd.go
@@ -153,7 +153,17 @@ func generateBatch(model 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 {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user