diff options
author | Melody Horn / boringcactus <melody@boringcactus.com> | 2021-06-13 11:52:24 -0600 |
---|---|---|
committer | Melody Horn / boringcactus <melody@boringcactus.com> | 2021-06-13 11:52:24 -0600 |
commit | 6a2f8ab0b2c7028636ddf06a7dd776f5f8b3ace6 (patch) | |
tree | bee826b90e538547bee6bf8617849d1bdc3554e5 /src/cli | |
parent | bb7da4934d4a5f0f5184ea382a122724d27d88a4 (diff) | |
download | tosin-6a2f8ab0b2c7028636ddf06a7dd776f5f8b3ace6.tar.gz tosin-6a2f8ab0b2c7028636ddf06a7dd776f5f8b3ace6.zip |
specify server port
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/run_server.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cli/run_server.rs b/src/cli/run_server.rs index 9e4d91c..242c824 100644 --- a/src/cli/run_server.rs +++ b/src/cli/run_server.rs @@ -3,13 +3,17 @@ use structopt::StructOpt; use crate::{Settings, UrlMap}; #[derive(StructOpt)] +/// Run an HTTP server pub struct RunServer { - + #[structopt(default_value = "8000")] + /// The port to listen on + port: u16, } impl RunServer { pub fn execute(self, urls: UrlMap, _settings: Settings) { - let server_task = warp::serve(urls).run(([127, 0, 0, 1], 3030)); + println!("Starting server at http://127.0.0.1:{}/", self.port); + let server_task = warp::serve(urls).run(([127, 0, 0, 1], self.port)); tokio::runtime::Builder::new_multi_thread() .enable_all() |