You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: 12-factor env vars FLAPI_PORT + FLAPI_HOST (#63) (#67)
- main.cpp: FLAPI_PORT / FLAPI_HOST fallback for --port / --host
with CLI > env > config > default precedence; invalid FLAPI_PORT
(non-int / out of range) exits 1 with single-line stderr, mirroring
the FLAPI_LOG_LEVEL pattern from #47
- main.cpp: new --host CLI flag, paired with FLAPI_HOST
- config_manager: http-host YAML key (default 0.0.0.0) +
get/setHttpHost accessors
- api_server: pass bindaddr to crow so the configured host is honoured
- test_env_overrides.py: 7 new pytest cases covering invalid
FLAPI_PORT (abc / 0 / 99999 / -1), env-only port bind,
CLI-wins-over-env precedence, and FLAPI_HOST bind
- CLI_REFERENCE / CONFIG_REFERENCE / AGENTS: docs reflect the new
env vars and the http-host config field
@@ -134,11 +135,22 @@ Overrides the HTTP server port defined in the configuration file.
134
135
| Type | integer |
135
136
| Default | From config file (typically `8080`) |
136
137
| Required | No |
138
+
| Environment variable |`FLAPI_PORT`|
137
139
138
140
**Description:**
139
141
140
142
When specified, this option overrides the `http-port` value in the configuration file. Useful for running multiple instances or when port configuration needs to be dynamic.
141
143
144
+
**Precedence (highest wins):**
145
+
1.`-p` / `--port` CLI flag
146
+
2.`FLAPI_PORT` environment variable
147
+
3.`http-port` from `flapi.yaml`
148
+
4. Built-in default (`8080`)
149
+
150
+
Invalid `FLAPI_PORT` values (non-integer, `<1`, `>65535`) cause flapi to
151
+
exit with a single-line error -- a typo like `FLAPI_PORT=abc` surfaces
152
+
immediately rather than silently falling through to the config-file value.
153
+
142
154
**Example:**
143
155
144
156
```bash
@@ -147,9 +159,52 @@ When specified, this option overrides the `http-port` value in the configuration
147
159
148
160
# Override config file port
149
161
./flapi -c production.yaml --port 80
162
+
163
+
# 12-factor: pick up the port from the environment
0 commit comments