Skip to content

Configure foreground mode via env var or extenddb.toml, not just CLI #138

@marvelefe

Description

@marvelefe

Problem or use case

extenddb serve --foreground (PR #126) currently must be set on the command line. For container deployments where command: is templated by the orchestrator, or where users prefer config files over flags, an env var (EXTENDDB_FOREGROUND=1) and/or a [server] config key would be more ergonomic.

The reviewer on #126 noted CLI-only is acceptable for v1, and asked that this be tracked as a follow-up rather than blocking the PR.

Proposed solution

Two ergonomic surfaces, either or both:

  1. Env var. Honor EXTENDDB__SERVER__FOREGROUND=1 via the existing EXTENDDB__<SECTION>__<KEY> override mechanism. This reuses the established override chain (CLI > env > file > default) and requires no new code beyond a config field.

  2. Config file. Add [server] foreground = false to extenddb.toml and extenddb.sample.toml. This makes the choice declarative for self-hosted deployments and Dockerfile-baked configs.

Precedence should be CLI flag > env var > config file > default (false), matching the project's existing convention.

Open questions

  • Should the config key live under [server] (deployment shape) or [logging] (it does flip log destination)? [server] is probably the right home — daemonize is a runtime mode, not just a logging concern.
  • Should there be a startup warning if foreground = true is set in the file but a daemon-style run is implied (e.g., the user passes no flag and just runs extenddb serve)? Probably not — the config is the source of truth.

Acceptance criteria

  • EXTENDDB__SERVER__FOREGROUND=1 extenddb serve runs in foreground.
  • [server] foreground = true in extenddb.toml runs in foreground.
  • CLI --foreground still wins over both.
  • --no-foreground (or absence of the flag) does not silently override env/config — i.e., the CLI default needs to be tri-state (flag set, flag explicitly false, flag absent) or only consume the flag when present.
  • extenddb.sample.toml documents the new option.
  • README "Running in Containers" section mentions the alternatives.

Context

Checklist

  • I have searched existing issues and the roadmap for duplicates
  • I have described the use case, not just the desired implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions