Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
9297ff83
Commit
9297ff83
authored
Sep 20, 2023
by
Michael Yang
Browse files
fix OLLAMA_HOST parsing for ip6
parent
ee4fd16f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
17 deletions
+8
-17
cmd/cmd.go
cmd/cmd.go
+8
-17
No files found.
cmd/cmd.go
View file @
9297ff83
...
@@ -655,28 +655,19 @@ func generateBatch(cmd *cobra.Command, model string) error {
...
@@ -655,28 +655,19 @@ func generateBatch(cmd *cobra.Command, model string) error {
}
}
func
RunServer
(
cmd
*
cobra
.
Command
,
_
[]
string
)
error
{
func
RunServer
(
cmd
*
cobra
.
Command
,
_
[]
string
)
error
{
host
,
port
:=
"127.0.0.1"
,
"11434"
host
,
port
,
err
:=
net
.
SplitHostPort
(
os
.
Getenv
(
"OLLAMA_HOST"
))
if
err
!=
nil
{
parts
:=
strings
.
Split
(
os
.
Getenv
(
"OLLAMA_HOST"
),
":"
)
host
,
port
=
"127.0.0.1"
,
"11434"
if
ip
:=
net
.
ParseIP
(
parts
[
0
]);
ip
!=
nil
{
if
ip
:=
net
.
ParseIP
(
os
.
Getenv
(
"OLLAMA_HOST"
));
ip
!=
nil
{
host
=
ip
.
String
()
host
=
ip
.
String
()
}
}
if
len
(
parts
)
>
1
{
port
=
parts
[
1
]
}
// deprecated: include port in OLLAMA_HOST
if
p
:=
os
.
Getenv
(
"OLLAMA_PORT"
);
p
!=
""
{
port
=
p
}
}
err
:=
initializeKeypair
()
if
err
:=
initializeKeypair
();
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
ln
,
err
:=
net
.
Listen
(
"tcp"
,
fmt
.
Sprintf
(
"%s:%s"
,
host
,
port
))
ln
,
err
:=
net
.
Listen
(
"tcp"
,
net
.
JoinHostPort
(
host
,
port
))
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment