Files
zeekay d725ab0c0c feat: merge KrakenD CE source for from-source builds
- Merge krakend-ce v2.12.1 Go source into gateway repo
- Rename module to github.com/hanzoai/gateway/v2
- Remove upstream usage telemetry (no phoning home)
- Multi-stage Dockerfile: build Go binary from source + bake config
- Update k8s deployments to use registry.hanzo.ai/gateway images
- Add imagePullSecrets for private registry auth
- Combined Makefile with build + deploy targets
- Zero upstream Docker image dependencies (supply chain security)
2026-02-09 20:44:33 -08:00

33 lines
833 B
Lua

function pre_backend( req )
local authHeader = req:headers("Authorization")
local first = string.find(authHeader, "%.")
local last = string.find(authHeader, "%.", first+1)
local rawData = string.sub(authHeader, first+1, last-1)
local decoded = from_base64(rawData)
local jwtData = json_parse(decoded)
req:url(req:url() .. jwtData["id"])
end
function post_proxy( resp )
local responseData = resp:data()
local data = {}
local col = responseData:get("collection")
local size = col:len()
responseData:set("total", size)
local paths = {}
for i=0,size-1 do
local element = col:get(i)
local t = element:get("path")
table.insert(paths, t)
end
responseData:set("paths", paths)
responseData:del("collection")
end
function json_error()
custom_error('{"msg":"I refuse to make any coffee, I am a teapot!"}', 418)
end