differentiate between bind and public

This commit is contained in:
Fate-JH 2024-07-01 16:45:21 -04:00
parent a5cd13ea92
commit 1beff98880

View file

@ -78,6 +78,11 @@ object Server {
def run(args: CliConfig): Unit = { def run(args: CliConfig): Unit = {
val bindAddress: InetAddress = val bindAddress: InetAddress =
args.bind match {
case Some(address) => InetAddress.getByName(address) // address from first argument
case None => InetAddress.getByName(Config.app.bind) // address from config
}
val publicAddress: InetAddress =
args.bind match { args.bind match {
case Some(address) => InetAddress.getByName(address) // address from first argument case Some(address) => InetAddress.getByName(address) // address from first argument
case None => InetAddress.getByName(Config.app.public) // address from config case None => InetAddress.getByName(Config.app.public) // address from config
@ -137,7 +142,7 @@ object Server {
system.spawn( system.spawn(
SocketPane(Seq( SocketPane(Seq(
SocketSetup("login", SocketSetupInfo(bindAddress, Seq(Config.app.login.port), loginPlan)), SocketSetup("login", SocketSetupInfo(bindAddress, Seq(Config.app.login.port), loginPlan)),
SocketSetup("world", SocketSetupInfo(bindAddress, Config.app.world.port +: Config.app.world.ports, sessionPlan)) SocketSetup("world", SocketSetupInfo(publicAddress, Config.app.world.port +: Config.app.world.ports, sessionPlan))
)), )),
name = SocketPane.SocketPaneKey.id name = SocketPane.SocketPaneKey.id
) )