I've been researching everywhere and I couldn't find my answer other than this:
try app.server.start(address: .hostname(hostname: STRING, port: INT))
I am assuming this will allow me to change the port for the vapor app however I am not sure where to place it within my vapor files.
Also, back on Vapor 3 there used to be an easy way to run your server under a different port using only the 'terminal' (for mac) by typing:
vapor run --port=8080
however, I don't think this is longer possible with vapor 4 :/ because every time a try that I get this error on my terminal even tho I am on my vapor app directory.
error: terminated(72): XPC_SERVICE_NAME=0 HOME=/Users...
Using the vapor run --port=8080
command for Vapor 3 was great because you could simply open a new tap on your terminal and run the same vapor app under a different port so you can test how your app will behave when using more than one server.
So basically... do you know how to change ports for your vapor 4 app? hopefully using terminal only?
Thank you
I use an environment variable to pass the value into the running app. This line is in my configure.swift
app.http.server.configuration.port = Int(Environment.get("PORT") ?? "8080" ) ?? 8080
If you are using Xcode, you can set the variable via the target's scheme. I deploy my apps on Ubuntu using supervisor
and pass the variables in the configuration script. Or, of course, you can just set it on a script's command line.