diff --git a/README.md b/README.md index 931c3d0..f230e18 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,5 @@ Environmental variables: - `SHORTEN_HOST` - hostname -- `POSTGRES_URI` - lib/pq connection string (see [here](https://pkg.go.dev/github.com/lib/pq#section-documentation)) +- `SHORTEN_BIND` - bind address (default: `127.0.0.1:4488`) +- `POSTGRES_URI` - lib/pq connection string (see [here](https://pkg.go.dev/github.com/lib/pq#section-documentation)) \ No newline at end of file diff --git a/main.go b/main.go index d5108dc..2afc854 100644 --- a/main.go +++ b/main.go @@ -71,7 +71,11 @@ func main() { panic(err) } - panic(http.ListenAndServe("127.0.0.1:4488", &Handler{db: db})) + bind := os.Getenv("SHORTEN_BIND") + if bind == "" { + bind = "127.0.0.1:4488" + } + panic(http.ListenAndServe(bind, &Handler{db: db})) } type Handler struct {