i am using next.js 9.5.x and I am looking for a way to configure hostname and port through next.config.js. I already searched the documentation about this, but I did not find a answer for this topic.
I read already a series of .env files in the next.config.js file for setting up serval things and passing some of the environment variables to the application code itself. I got already some environment variables specifying the hostname and port and would like to reuse them to setup the hostname and port for the server / development-server.
The only two solutions I found, for changing these two parameters, are the command line settings of next, or having a custom server.js. At the moment I am using a custom server.js and inside I read all .env files again, just for having the port and hostname setup.
I want to get rid of the server.js, since I believe that there must be a way for configuring this through the next.config.js file, I have anyway, and where everything is already in place.
Thank you for some information about this.