garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/adr/014-runtime-configuration-and-operations.md

raw

ADR-014: Runtime Configuration and Operations


Metadata:


Context

Problem: Running cartopolis_simulator on a host (ADR-007) requires listen address, database path, tile URL template, texture dir, tick rate, and AOI radius (ADR-012) without recompiling.

Requirements:

Decision

Layered config: defaults in code → optional cartopolis.toml → CARTO_* env vars → CLI flags (clap), each layer overriding the previous.

Implementation (cartopolis_simulator/src/config.rs, cli.rs):

Config keys (all with in-code defaults):

cartopolis.toml is loaded only if present; env keys are CARTO_<field> (e.g. CARTO_listen).

Rationale

Primary Reasoning:

  1. 12-factor style env overrides are standard for containers.
  2. File config matches operator expectations for a dedicated server.
  3. Separation: Keeps secrets out of source control.

Alternatives Considered:

AlternativeProsConsRejected Because
Env onlySimpleTedious for many keysFile + env is nicer
CLI onlyExplicitPoor for servicesNot sufficient alone
Dynamic remote configFancyOps burdenFuture

Consequences

Positive:

Negative:

Related