Hello,
I was wondering if it was possible in akka-http server, a way to set the default port directly in the configuration.
For example akka.http.server.default-http-port and why not akka.http.server.default-https-port.
Currently in an application using akka-http, if we want to configure the port of our server in a configuration file, we must implement it ourselves. I think it would be practical to have a way to do it directly.
Thanks for the ticket, @fmeriaux.
I agree that could be useful. It is already now possible to omit the port with any of the Http.bindXXX methods. In that case an internal DefaultPortForProtocol is used as a marker and later replaced with statically determined values here:
We could change that choosePort method to also take the settings into regard and add the settings you suggest in ServerSettings. We should then deprecate ConnectionContext.getDefaultPort as that cannot be changed to take settings into account.
I can pick this one if nobody works on it yet.
Sure, that鈥檇 be great :)
I've implemented the change. Need to add some tests and will make a PR.