Spaces:
Sleeping
Sleeping
File size: 477 Bytes
00c24e6 4464da3 00c24e6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
local valid_api_key = os.getenv("OLLAMA_API_KEY")
if not valid_api_key then
ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR
ngx.say("Internal Server Error: API key not set")
return ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
local headers = ngx.req.get_headers()
local api_key = headers["Authorization"]
if api_key ~= "Bearer " .. valid_api_key then
ngx.status = ngx.HTTP_UNAUTHORIZED
ngx.say("Unauthorized")
return ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
|