-
Notifications
You must be signed in to change notification settings - Fork 218
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (28 loc) · 634 Bytes
/
main.py
File metadata and controls
34 lines (28 loc) · 634 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import click
import uvicorn
from core.config import config
@click.command()
@click.option(
"--env",
type=click.Choice(["local", "dev", "prod"], case_sensitive=False),
default="local",
)
@click.option(
"--debug",
type=click.BOOL,
is_flag=True,
default=False,
)
def main(env: str, debug: bool):
os.environ["ENV"] = env
os.environ["DEBUG"] = str(debug)
uvicorn.run(
app="app.server:app",
host=config.APP_HOST,
port=config.APP_PORT,
reload=True if config.ENV != "production" else False,
workers=1,
)
if __name__ == "__main__":
main()