add registry tracking

This commit is contained in:
Karol Wypchlo 2021-02-16 16:29:01 +01:00
parent 3560d73acf
commit f1c952e87b
1 changed files with 17 additions and 0 deletions

View File

@ -277,6 +277,23 @@ server {
proxy_set_header User-Agent: Sia-Agent; proxy_set_header User-Agent: Sia-Agent;
proxy_read_timeout 600; # siad should timeout with 404 after 5 minutes proxy_read_timeout 600; # siad should timeout with 404 after 5 minutes
proxy_pass http://siad/skynet/registry; proxy_pass http://siad/skynet/registry;
# register the registry access in accounts service (cookies should contain jwt)
log_by_lua_block {
if ngx.status == ngx.HTTP_OK or ngx.status == ngx.HTTP_NOT_FOUND then
local http = require("socket.http")
local headers = { Cookie = ngx.req.get_headers()["Cookie"] }
local method = ngx.req.get_method() == ngx.HTTP_GET and "read" or "write"
local ok, statusCode, headers, statusText = http.request {
url = "http://accounts:3000/track/registry/" .. method,
method = "POST",
headers = headers
}
if statusCode ~= ngx.HTTP_NO_CONTENT then
ngx.log(ngx.ERR, "accounts endpoint /track/registry/" .. method .. " failed with error " .. statusCode)
end
end
}
} }
location /skynet/skyfile { location /skynet/skyfile {