Skip to content

12-factor: FLAPI_PORT + FLAPI_HOST env vars #63

Closed

Description

@jrosskopf

Follow-up from epic #40 / PR #57. `FLAPI_CONFIG` and `FLAPI_LOG_LEVEL`
shipped in v26.05.23; `FLAPI_PORT` and `FLAPI_HOST` were explicitly
deferred to keep the 12-factor scope narrow.

Scope

Wire two more env-var fallbacks in `src/main.cpp` following the same
pattern as `FLAPI_CONFIG` / `FLAPI_LOG_LEVEL`:

  • `FLAPI_PORT` falls back for `-p` / `--port`. Today port is
    CLI-flag-or-config-file only. Must coexist with the existing
    `server.http-port` config field (precedence:
    CLI > env > config > built-in default).
  • `FLAPI_HOST` falls back for the bind host. There is no CLI flag
    for host today; if we want CLI > env semantics we should add a
    `--host` flag too.

Acceptance

  • argparse `is_used()` precedence enforced (same idiom as Self-packaging #7: 12-factor env-var hardening (FLAPI_CONFIG + FLAPI_LOG_LEVEL) #47).
  • Invalid `FLAPI_PORT` (non-int, out-of-range) → single-line stderr
    error, exit 1 (mirrors invalid `FLAPI_LOG_LEVEL` behaviour).
  • 4 new cases in `test/integration/test_env_overrides.py`
    (`FLAPI_PORT` precedence, invalid `FLAPI_PORT` rejected, same for
    `FLAPI_HOST`).
  • `docs/CLI_REFERENCE.md` + `docs/CONFIG_REFERENCE.md` 12-factor
    checklist + landing-page `docs/tools/server-cli.md` updated.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions