Skip to content

Commit f56de15

Browse files
authored
Merge pull request #3 from brosner/05-24-add_port_env_override
add PORT env override
2 parents 5fefca5 + 4ae9283 commit f56de15

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tests/test_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_cli_server_dev(MockApplication):
2424

2525
MockApplication.assert_called_once_with(
2626
{
27-
"bind": "127.0.0.1:8000",
27+
"bind": "0.0.0.0:8000",
2828
"reload": True,
2929
}
3030
)

teufa/cli.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23

34
import click
@@ -14,8 +15,9 @@ def cli():
1415
@cli.command()
1516
@click.option("--dev/--no-dev", default=False)
1617
def server(dev):
18+
port = os.environ.get("PORT", 8000)
1719
cfg = {
18-
"bind": "127.0.0.1:8000",
20+
"bind": f"0.0.0.0:{port}",
1921
"reload": dev,
2022
}
2123
teufa.server.Application(cfg).run()

0 commit comments

Comments
 (0)