Spaces:
Sleeping
Sleeping
barisaydin
commited on
Commit
•
c01a5f5
1
Parent(s):
0527cf8
Delete validate_api_key.lua
Browse files- validate_api_key.lua +0 -17
validate_api_key.lua
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
local valid_api_key = os.getenv("OLLAMA_API_KEY")
|
2 |
-
|
3 |
-
if not valid_api_key then
|
4 |
-
ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR
|
5 |
-
ngx.say("Internal Server Error: API key not set")
|
6 |
-
return ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
|
7 |
-
end
|
8 |
-
|
9 |
-
local headers = ngx.req.get_headers()
|
10 |
-
local api_key = headers["Authorization"]
|
11 |
-
|
12 |
-
if api_key ~= "Bearer " .. valid_api_key then
|
13 |
-
ngx.status = ngx.HTTP_UNAUTHORIZED
|
14 |
-
ngx.say("Unauthorized")
|
15 |
-
return ngx.exit(ngx.HTTP_UNAUTHORIZED)
|
16 |
-
end
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|