add PORT env override

This commit is contained in:
Brian Rosner 2024-05-24 22:37:30 -06:00
parent 5fefca50a7
commit 4ae92830db
2 changed files with 4 additions and 2 deletions

View File

@ -24,7 +24,7 @@ def test_cli_server_dev(MockApplication):
MockApplication.assert_called_once_with( MockApplication.assert_called_once_with(
{ {
"bind": "127.0.0.1:8000", "bind": "0.0.0.0:8000",
"reload": True, "reload": True,
} }
) )

View File

@ -1,3 +1,4 @@
import os
import sys import sys
import click import click
@ -14,8 +15,9 @@ def cli():
@cli.command() @cli.command()
@click.option("--dev/--no-dev", default=False) @click.option("--dev/--no-dev", default=False)
def server(dev): def server(dev):
port = os.environ.get("PORT", 8000)
cfg = { cfg = {
"bind": "127.0.0.1:8000", "bind": f"0.0.0.0:{port}",
"reload": dev, "reload": dev,
} }
teufa.server.Application(cfg).run() teufa.server.Application(cfg).run()