Command Line Arguments
You can override certain Vapor settings through command line arguments passed during launch. This allows you to change settings dynamically without needing to recompile your application.
Working Directory
By default, Vapor uses the current working directory as the root of the project. This will work if you run Vapor using vapor run or another method from the root directory of the project. However, if you run your executable from a directory that is not the root directory of your project, the application will not know where to find the Public or Resources folders.
To circumvent this, pass the root directory of the project as --workDir. For example:
/home/username/project/.build/debug/App --workDir=/home/username/project/
Host and Port
Depending on your server configuration, you may need to change the default host or port that your server binds to.
Simply pass --ip or --port, respectively. For example:
vapor run --ip=192.168.0.1 --port=9000
Updated less than a minute ago
