fix: module-level app loads config.yaml (uvicorn app.main:app); bind 0.0.0.0 for LAN/device reachability
This commit is contained in:
1 parent
b00312cbe5
commit
e91d185996
3 files changed
+13
-8
No files matched your search
+11
-7
@@ -38,13 +38,6 @@ def make_app(cfg: Config | None = None) -> FastAPI:
|
||||
return app
|
||||
|
||||
|
||||
def main() -> None:
|
||||
import uvicorn
|
||||
|
||||
cfg = _load_config()
|
||||
uvicorn.run(make_app(cfg), host=cfg.host, port=cfg.port)
|
||||
|
||||
|
||||
def _load_config() -> Config:
|
||||
"""Load config.yaml from the repo root; fall back to all-mock defaults."""
|
||||
import os
|
||||
@@ -58,5 +51,16 @@ def _load_config() -> Config:
|
||||
return Config()
|
||||
|
||||
|
||||
# Module-level app so `uvicorn app.main:app` loads config.yaml (REQ: real
|
||||
# token in production). `main()` is the equivalent entrypoint.
|
||||
app = make_app(_load_config())
|
||||
|
||||
|
||||
def main() -> None:
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(app, host=app.state.cfg.host, port=app.state.cfg.port)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user