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
af8a8a6b
"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "15b125bb0ea91addb9083d2bacc6cb1a8fcd7b9d"
Commit
af8a8a6b
authored
Mar 27, 2024
by
Michael Yang
Browse files
fix: trim quotes on OLLAMA_ORIGINS
parent
461ad250
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 @
af8a8a6b
...
@@ -1013,16 +1013,14 @@ func allowedHostsMiddleware(addr net.Addr) gin.HandlerFunc {
...
@@ -1013,16 +1013,14 @@ func allowedHostsMiddleware(addr net.Addr) gin.HandlerFunc {
}
}
func
(
s
*
Server
)
GenerateRoutes
()
http
.
Handler
{
func
(
s
*
Server
)
GenerateRoutes
()
http
.
Handler
{
var
origins
[]
string
if
o
:=
os
.
Getenv
(
"OLLAMA_ORIGINS"
);
o
!=
""
{
origins
=
strings
.
Split
(
o
,
","
)
}
config
:=
cors
.
DefaultConfig
()
config
:=
cors
.
DefaultConfig
()
config
.
AllowWildcard
=
true
config
.
AllowWildcard
=
true
config
.
AllowBrowserExtensions
=
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
{
for
_
,
allowOrigin
:=
range
defaultAllowOrigins
{
config
.
AllowOrigins
=
append
(
config
.
AllowOrigins
,
config
.
AllowOrigins
=
append
(
config
.
AllowOrigins
,
fmt
.
Sprintf
(
"http://%s"
,
allowOrigin
),
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