Commit 3742680
committed
fix(rest-api): warn about disabled auth at server startup, not just the CLI
The exposed-without-token warning lived only in main(), so a non-CLI launch
(uvicorn/gunicorn --factory) that binds a public interface without a token got
a silently world-open API with no warning. Move it into create_app()'s lifespan
startup so it fires for every launch path. create_app() can't see the bind host
under a factory launch, so the check is host-agnostic (warn whenever no token is
configured) — a single calm log line, harmless on loopback, and silent in the
unit suite (tests don't enter the TestClient context manager, so lifespan never
runs there).1 parent 8ced237 commit 3742680
1 file changed
Lines changed: 14 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
| |||
563 | 576 | | |
564 | 577 | | |
565 | 578 | | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | 579 | | |
581 | 580 | | |
582 | 581 | | |
| |||
0 commit comments