From 6fa098ae398eb58c3aafd50abcc3c5fa597fce48 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Fri, 20 Oct 2023 22:16:44 +0800 Subject: [PATCH] refactor(clustering): simplify parse_proxy_url() --- kong/clustering/utils.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kong/clustering/utils.lua b/kong/clustering/utils.lua index 891aa974c691..72e1cca30c5e 100644 --- a/kong/clustering/utils.lua +++ b/kong/clustering/utils.lua @@ -30,9 +30,9 @@ local CLUSTER_PROXY_SSL_TERMINATOR_SOCK = fmt("unix:%s/cluster_proxy_ssl_termina local _M = {} -local function parse_proxy_url(conf) +local function parse_proxy_url(proxy_server) local ret = {} - local proxy_server = conf.proxy_server + if proxy_server then -- assume proxy_server is validated in conf_loader local parsed = parse_url(proxy_server) @@ -81,7 +81,7 @@ function _M.connect_cp(dp, endpoint, protocols) } if conf.cluster_use_proxy then - local proxy_opts = parse_proxy_url(conf) + local proxy_opts = parse_proxy_url(conf.proxy_server) opts.proxy_opts = { wss_proxy = proxy_opts.proxy_url, wss_proxy_authorization = proxy_opts.proxy_authorization,