Spaces:
Sleeping
Sleeping
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 | |