From 31b7090863806b866846ed302c6204c95894a98a Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 7 Jan 2022 13:36:04 +0100 Subject: [PATCH] change var name and add description --- docker/nginx/conf.d/include/track-registry | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/nginx/conf.d/include/track-registry b/docker/nginx/conf.d/include/track-registry index ee5bc8b3..5461ee53 100644 --- a/docker/nginx/conf.d/include/track-registry +++ b/docker/nginx/conf.d/include/track-registry @@ -6,16 +6,19 @@ log_by_lua_block { if premature then return end local httpc = require("resty.http").new() - local method = request_method == "GET" and "read" or "write" + + -- based on request method we assign a registry action string used + -- in track endpoint namely "read" for GET and "write" for POST + local registry_action = request_method == "GET" and "read" or "write" -- 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/track/registry/" .. method, { + local res, err = httpc:request_uri("http://10.10.10.70:3000/track/registry/" .. registry_action, { method = "POST", headers = { ["Cookie"] = "skynet-jwt=" .. jwt }, }) if err or (res and res.status ~= ngx.HTTP_NO_CONTENT) then - ngx.log(ngx.ERR, "Failed accounts service request /track/registry/" .. method .. ": ", err or ("[HTTP " .. res.status .. "] " .. res.body)) + ngx.log(ngx.ERR, "Failed accounts service request /track/registry/" .. registry_action .. ": ", err or ("[HTTP " .. res.status .. "] " .. res.body)) end end