Skip to content

Commit

Permalink
updated run and readme to clearify params
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig committed Aug 20, 2020
1 parent 4725035 commit 41fc7fc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,29 +99,29 @@ docker run -d -p 80:80 -e APP_MODULE="custom_app.custom_script:api" myimage
### Waitress Options

#### Host & Port Setup
By default, Waitress has been setup to server on all hostnames on port 80 using both IPv4 and IPv6. This translates to `--listen:*:80`. This works for most applications using the basic setups listed above.
By default, Waitress has been setup to server on all hostnames on port 80 using both IPv4 and IPv6. This translates to `--listen=*:80`. This works for most applications using the basic setups listed above.

You may have different needs so you can adjust and manipulate this by passing in environment variable to adjust the settings.

There are 2 options for doing this:
##### `WAITRESS_LISTEN`

Pass a comma separated list of host:port (EG: `host:post,host:port,host:port`) to the `WAITRESS_LISTEN` param

1. Pass a comma separated list of `host:port,host:port` to the `WAITRESS_LISTEN` param

The `WAITRESS_LISTEN` param takes precedence over `WAITRESS_HOST`/`WAITRESS_PORT` options, meaning if you include all 3, host and port settings will be ignored.

To set Waitress to use port 8080, sent the `WAITRESS_LISTEN` param like
To set Waitress to use port 8080, sent the `WAITRESS_LISTEN` param like
```bash
docker run -d -p 80:8080 -e WAITRESS_LISTEN=*:8080 myimage
````

2. Pass the host and port separately as `WAITRESS_HOST` and/or `WAITRESS_PORT`. If port is left out, it will default to 80.
##### `WAITRESS_HOST` / `WAITRESS_PORT`
Pass the host and port separately as `WAITRESS_HOST` and/or `WAITRESS_PORT`. If port is left out, it will default to 80.

If you want only IPv4, you could use advanced param listed in the section below, but you could also use
```bash
docker run -d -p 80:8080 -e WAITRESS_HOST=0.0.0.0 -e WAITRESS_PORT=8080 myimage
````
**Note:** The `WAITRESS_LISTEN` param takes precedence over `WAITRESS_HOST` & `WAITRESS_PORT` options, meaning if you include all 3, `WAITRESS_HOST` & `WAITRESS_PORT` will be ignored.
#### Advanced Options
Many of the
Expand Down
20 changes: 14 additions & 6 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,23 @@ if [[ -v $WAITRESS_LISTEN ]]; then
done
else
if [[ -v $WAITRESS_HOST ]]; then
params="--host=$WAITRESS_HOST"
if [[ -v $WAITRESS_PORT ]]; then
params=" $params --port=$WAITRESS_PORT"
if [[ -z $params ]]; then
params="--host=$WAITRESS_HOST"
else
params=" $params --port=80"
params=" $params --host=$WAITRESS_HOST"
fi
else
params="--listen=*:80"
fi
if [[ -v $WAITRESS_PORT ]]; then
if [[ -z $params ]]; then
params="--port=$WAITRESS_PORT"
else
params=" $params --port=$WAITRESS_PORT"
fi
fi
fi

if [[ -z $params ]]; then
params="--listen=*:80"
fi

if [[ -v $WAITRESS_NO_IPV6 ]]; then
Expand Down

0 comments on commit 41fc7fc

Please sign in to comment.