forked from uc-cdis/audit-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
28 lines (22 loc) · 673 Bytes
/
Copy pathrun.py
File metadata and controls
28 lines (22 loc) · 673 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
"""
Usage:
- Run app: python run.py
- Generate openapi docs: python run.py openapi
"""
import os
import sys
import uvicorn
import yaml
from audit.app import app_init
from audit import logger
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
if __name__ == "__main__":
if sys.argv[-1] == "openapi":
schema = app_init().openapi()
path = os.path.join(CURRENT_DIR, "docs/openapi.yaml")
yaml.Dumper.ignore_aliases = lambda *args: True
with open(path, "w+") as f:
yaml.dump(schema, f, default_flow_style=False)
logger.info(f"Saved docs at {path}")
else:
uvicorn.run("audit.asgi:app", reload=True)