add registry tracking
This commit is contained in:
parent
3560d73acf
commit
f1c952e87b
|
@ -277,6 +277,23 @@ server {
|
|||
proxy_set_header User-Agent: Sia-Agent;
|
||||
proxy_read_timeout 600; # siad should timeout with 404 after 5 minutes
|
||||
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 {
|
||||
|
|
Reference in New Issue