api - client side (untested)
This commit is contained in:
@@ -87,19 +87,13 @@ if use_remote_api then
|
||||
f:close()
|
||||
|
||||
-- Save and ask a machine ID if needed
|
||||
local f = io.open("/opt/bunkerized-nginx/cache/machine.id", "rw")
|
||||
local f = io.open("/etc/nginx/machine.id", "rw")
|
||||
if f == nil then
|
||||
local res, id = remoteapi.register()
|
||||
if not res then
|
||||
logger.log(ngx.ERR, "REMOTE API", "Can't register to the remote API")
|
||||
else
|
||||
logger.log(ngx.ERR, "REMOTE API", "Successfully registered to the remote API")
|
||||
f:write(data)
|
||||
ngx.shared.remote_api:set("id", data, 0)
|
||||
end
|
||||
id = nil
|
||||
logger.log(ngx.ERR, "REMOTE API", "USE_REMOTE_API is set to yes but machine ID is not generated - communication with {{ REMOTE_API_SERVER }} won't work")
|
||||
else
|
||||
logger.log(ngx.ERR, "REMOTE API", "*NOT AN ERROR* Using existing machine ID from cache")
|
||||
id = f:read("*all")
|
||||
logger.log(ngx.ERR, "REMOTE API", "*NOT AN ERROR* Machine ID = " .. id)
|
||||
end
|
||||
f:close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user