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
035b274b
Unverified
Commit
035b274b
authored
Mar 28, 2024
by
Michael Yang
Committed by
GitHub
Mar 28, 2024
Browse files
Merge pull request #3379 from ollama/mxyng/origins
fix: trim quotes on OLLAMA_ORIGINS
parents
9c6a2549
af8a8a6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
server/routes.go
server/routes.go
+4
-6
No files found.
server/routes.go
View file @
035b274b
...
...
@@ -1013,16 +1013,14 @@ func allowedHostsMiddleware(addr net.Addr) gin.HandlerFunc {
}
func
(
s
*
Server
)
GenerateRoutes
()
http
.
Handler
{
var
origins
[]
string
if
o
:=
os
.
Getenv
(
"OLLAMA_ORIGINS"
);
o
!=
""
{
origins
=
strings
.
Split
(
o
,
","
)
}
config
:=
cors
.
DefaultConfig
()
config
.
AllowWildcard
=
true
config
.
AllowBrowserExtensions
=
true
config
.
AllowOrigins
=
origins
if
allowedOrigins
:=
strings
.
Trim
(
os
.
Getenv
(
"OLLAMA_ORIGINS"
),
"
\"
'"
);
allowedOrigins
!=
""
{
config
.
AllowOrigins
=
strings
.
Split
(
allowedOrigins
,
","
)
}
for
_
,
allowOrigin
:=
range
defaultAllowOrigins
{
config
.
AllowOrigins
=
append
(
config
.
AllowOrigins
,
fmt
.
Sprintf
(
"http://%s"
,
allowOrigin
),
...
...
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