From 1fe629f238d8c883dea9b479af855bbe3f822552 Mon Sep 17 00:00:00 2001 From: Dheeraj Dwivedi Date: Fri, 14 Oct 2016 02:08:47 +0530 Subject: [PATCH] fix(serf) properly set the admin IP in the Serf script --- kong/cmd/utils/prefix_handler.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kong/cmd/utils/prefix_handler.lua b/kong/cmd/utils/prefix_handler.lua index d99fbc72b98..b1149a1ee63 100644 --- a/kong/cmd/utils/prefix_handler.lua +++ b/kong/cmd/utils/prefix_handler.lua @@ -223,7 +223,13 @@ local function prepare_prefix(kong_config, nginx_custom_template_path) if not resty_bin then return nil, err end log.verbose("saving serf shell script handler to %s", kong_config.serf_event) - local script = fmt(script_template, "127.0.0.1", kong_config.admin_port, resty_bin) + -- setting serf admin ip + local admin_ip = kong_config.admin_ip + if kong_config.admin_ip == "0.0.0.0" then + admin_ip = "127.0.0.1" + end + -- saving serf script handler + local script = fmt(script_template, admin_ip, kong_config.admin_port, resty_bin) pl_file.write(kong_config.serf_event, script) local ok, _, _, stderr = pl_utils.executeex("chmod +x "..kong_config.serf_event) if not ok then return nil, stderr end