Skip to content

Commit

Permalink
support serving on a custom port
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeterdev committed Nov 30, 2023
1 parent ffa47f2 commit 1cd2064
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ Options:
-w
Run in BOS Web Engine mode

--port <PORT>
Port to serve on

[default: 3030]

-r, --replacements <REPLACEMENTS>
Path to file with replacements map

Expand Down Expand Up @@ -152,3 +157,19 @@ region: us
```
Then start with `ngrok start --all`

## Contributing

### Cutting a new release

Once all changes are merged into `main`, use `cargo release` to cut a new release. This will automatically update the version in `Cargo.toml`, create a new git tag, and push the tag to GitHub.

Given the next release version will be `0.9.0`

```bash
# dry run to make sure everything looks normal
cargo release 0.9.0
# execute the release
cargo release 0.9.0 --execute
```
9 changes: 6 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ struct Args {
/// Run in BOS Web Engine mode
#[arg(short = 'w')]
web_engine: bool,
/// Port to serve on
#[arg(long, default_value = "3030")]
port: u16,
/// Path to file with replacements map
#[clap(short, long, value_hint = clap::ValueHint::DirPath)]
replacements: Option<PathBuf>,
Expand Down Expand Up @@ -220,11 +223,11 @@ async fn main() {
.collect::<Vec<String>>()
.join("\n");
println!(
"\nServing .jsx/.tsx files on http://127.0.0.1:3030\n\n{}",
display_paths_str
"\nServing .jsx/.tsx files on http://127.0.0.1:{}\n\n{}",
args.port, display_paths_str
);

warp::serve(api).run(([127, 0, 0, 1], 3030)).await;
warp::serve(api).run(([127, 0, 0, 1], args.port)).await;
}

#[cfg(test)]
Expand Down

0 comments on commit 1cd2064

Please sign in to comment.