Skip to content

Commit

Permalink
Fix remote control bind
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson committed Feb 28, 2024
1 parent bcb7eae commit 0ed13a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions cartridge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ local function cfg(opts, box_opts)
workdir = opts.workdir,
box_opts = box_opts,
binary_port = advertise.service,
remote_control_host = advertise.host,
advertise_uri = advertise_uri,
upgrade_schema = opts.upgrade_schema,
enable_failover_suppressing = opts.enable_failover_suppressing,
Expand Down
17 changes: 4 additions & 13 deletions cartridge/confapplier.lua
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,7 @@ local function init(opts)
workdir = 'string',
box_opts = 'table',
binary_port = 'number',
remote_control_host = 'string',
advertise_uri = 'string',
upgrade_schema = '?boolean',
enable_failover_suppressing = '?boolean',
Expand All @@ -806,6 +807,7 @@ local function init(opts)
vars.workdir = opts.workdir
vars.box_opts = opts.box_opts
vars.binary_port = opts.binary_port
vars.remote_control_host = opts.remote_control_host
vars.advertise_uri = opts.advertise_uri
vars.upgrade_schema = opts.upgrade_schema
vars.enable_failover_suppressing = opts.enable_failover_suppressing
Expand All @@ -822,18 +824,7 @@ local function init(opts)
vars.ssl_client_key_file = opts.ssl_client_key_file
vars.ssl_client_password = opts.ssl_client_password

local parts = uri_tools.parse(opts.advertise_uri)
local family = parts.ipv6 and 'AF_INET6' or 'AF_INET'
local addrinfo, err = socket.getaddrinfo(
parts.host, parts.service,
{family=family, type='SOCK_STREAM'}
)
if addrinfo == nil then
set_state('InitError', err)
return nil, InitError:new("Could not resolve advertise uri %s", opts.advertise_uri)
end

local ok, err = remote_control.bind(addrinfo[1].host, vars.binary_port, {
local ok, err = remote_control.bind(vars.remote_control_host, vars.binary_port, {
transport = vars.transport, -- '' or 'ssl'
ssl_ciphers = vars.ssl_ciphers,
ssl_ca_file = vars.ssl_server_ca_file,
Expand All @@ -846,7 +837,7 @@ local function init(opts)
set_state('InitError', err)
return nil, err
else
log.info('Remote control bound to %s:%d', addrinfo[1].host, vars.binary_port)
log.info('Remote control bound to %s:%d', vars.remote_control_host, vars.binary_port)
end

local config_filename = fio.pathjoin(vars.workdir, 'config')
Expand Down

0 comments on commit 0ed13a4

Please sign in to comment.