support skydb in hns

This commit is contained in:
Karol Wypchlo 2020-11-03 16:24:56 +01:00
parent 11186f3fd6
commit 4dc3588f81
1 changed files with 4 additions and 3 deletions

View File

@ -168,9 +168,6 @@ server {
-- make a get request to /skynet/registry endpoint with the credentials from text record -- make a get request to /skynet/registry endpoint with the credentials from text record
local registry_res = ngx.location.capture("/skynet/registry?publickey=" .. publickey .. "&datakey=" .. datakey) local registry_res = ngx.location.capture("/skynet/registry?publickey=" .. publickey .. "&datakey=" .. datakey)
ngx.header.content_type = 'text/plain'
ngx.print(registry_res.body)
-- we want to fail with a generic 404 when /skynet/registry returns anything but 200 OK -- we want to fail with a generic 404 when /skynet/registry returns anything but 200 OK
if registry_res.status ~= ngx.HTTP_OK then if registry_res.status ~= ngx.HTTP_OK then
ngx.exit(ngx.HTTP_NOT_FOUND) ngx.exit(ngx.HTTP_NOT_FOUND)
@ -183,6 +180,10 @@ server {
return string.char(tonumber(cc, 16)) return string.char(tonumber(cc, 16))
end)) end))
ngx.header.content_type = 'text/plain'
ngx.print(data)
ngx.exit(ngx.HTTP_OK)
skylink = data skylink = data
end end