From ad090fd1ff9a8cf88a84e58fef67904d1c394785 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 14 Apr 2022 15:58:01 +0200 Subject: [PATCH] pass skylink from request context to /user/limits --- docker/nginx/libs/skynet/account.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/nginx/libs/skynet/account.lua b/docker/nginx/libs/skynet/account.lua index 56c99897..709d8130 100644 --- a/docker/nginx/libs/skynet/account.lua +++ b/docker/nginx/libs/skynet/account.lua @@ -76,9 +76,16 @@ function _M.get_account_limits() if ngx.var.account_limits == "" then local httpc = require("resty.http").new() + local uri = "http://10.10.10.70:3000/user/limits" + + -- include skylink if it is available in the context of request + -- todo: this should not rely on skylink variable to be defined + if ngx.var.skylink ~= nil and ngx.var.skylink ~= "" then + uri = uri .. "/" .. ngx.var.skylink + end -- 10.10.10.70 points to accounts service (alias not available when using resty-http) - local res, err = httpc:request_uri("http://10.10.10.70:3000/user/limits?unit=byte", { + local res, err = httpc:request_uri(uri .. "?unit=byte", { headers = auth_headers, })