atomic-swap
atomic-swap copied to clipboard
ui: make swapd ports configurable
make swapd http and ws ports configurable instead of hard-coded
Can clarify the issue a little and the desired behavior? It looks like the ports are configurable already:
atomic-swap$ ./swapd --help | grep port
--rpc-port value port for the daemon RPC server to run on; default 5001 (default: 0)
--ws-port value port for the daemon RPC websockets server to run on; default 8080 (default: 0)
--libp2p-port value libp2p port to listen on (default: 0)
I can see above that there is an issue with how the values are defaulted. Setting the default value correctly in the argument parsing code to the stated (above) value is a trivial change, but it looks like the default value is actually dependent on other flags:
p = uint16(c.Uint(flagRPCPort))
switch {
case p != 0:
rpcPort = p
case devXMRTaker:
rpcPort = defaultXMRTakerRPCPort
case devXMRMaker:
rpcPort = defaultXMRMakerRPCPort
default:
rpcPort = defaultRPCPort
}
wsPort := uint16(c.Uint(flagWSPort))
switch {
case wsPort != 0:
case devXMRTaker:
wsPort = defaultXMRTakerWSPort
case devXMRMaker:
wsPort = defaultXMRMakerWSPort
default:
wsPort = defaultWSPort
}
hey @dimalinux , the issue is referencing the port for the UI only. currently it's hard-coded to send RPC calls to http://localhost:5001, see here: https://github.com/noot/atomic-swap/blob/master/ui/src/utils/rpcApi.ts#L12
the intended behaviour is to have the UI select what port to use based on some env variable, falling back to 5001 if it's not set.