{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Command Line Arguments","type":"basic","slug":"command-line-arguments","excerpt":"","body":"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.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Working Directory\"\n}\n[/block]\nBy 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.\n\nTo circumvent this, pass the root directory of the project as `--workDir`. For example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/home/username/project/.build/debug/App --workDir=/home/username/project/\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Host and Port\"\n}\n[/block]\nDepending on your server configuration, you may need to change the default host or port that your server binds to.\n\nSimply pass `--ip` or `--port`, respectively. For example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"vapor run --ip=192.168.0.1 --port=9000\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5768701c72cd4c0e000fad31","__v":0,"user":"57086f3d447c410e00221bd1","githubsync":"","version":{"version":"0.12","version_clean":"0.12.0","codename":"Client Clyde","is_stable":false,"is_beta":true,"is_hidden":false,"is_deprecated":true,"categories":["5768701b72cd4c0e000fad19","5768701b72cd4c0e000fad1a","5768701b72cd4c0e000fad1b","5768701b72cd4c0e000fad1c"],"_id":"5768701b72cd4c0e000fad18","releaseDate":"2016-06-20T22:37:15.641Z","__v":1,"createdAt":"2016-06-20T22:37:15.641Z","project":"57086fe855a4690e005de407"},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Advanced","slug":"advanced","order":3,"from_sync":false,"reference":false,"_id":"5768701b72cd4c0e000fad1c","createdAt":"2016-05-07T05:36:22.630Z","version":"5768701b72cd4c0e000fad18","project":"57086fe855a4690e005de407","__v":0},"createdAt":"2016-05-07T05:29:57.889Z","parentDoc":null,"project":"57086fe855a4690e005de407"}

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. [block:api-header] { "type": "basic", "title": "Working Directory" } [/block] 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: [block:code] { "codes": [ { "code": "/home/username/project/.build/debug/App --workDir=/home/username/project/", "language": "text" } ] } [/block] [block:api-header] { "type": "basic", "title": "Host and Port" } [/block] 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: [block:code] { "codes": [ { "code": "vapor run --ip=192.168.0.1 --port=9000", "language": "text" } ] } [/block]