secs_server: relative-path defaults so the binary runs outside docker
Previously --config / --state-table / --pj-state-table / --cj-state-table defaulted to /app/data/..., which only resolves inside the docker image. A host build run from the repo root errored out unless every flag was passed explicitly. Switch to data/equipment.yaml (and siblings) relative to CWD — docker still works because WORKDIR=/app puts /app/data/... at the same relative location, and host builds run from the repo root resolve to <repo>/data/.... Existing callers that pass explicit paths (the proof commands, tshark_validate.sh, secs4j_validate.sh, docker compose) are unaffected. Verified --validate-config under docker still finds all four YAMLs and the tshark proof still passes (69 frames, 0 malformed). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -54,12 +54,16 @@ void refresh(gem::EquipmentDataModel& m, const gem::ControlStateMachine& sm) {
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
const auto port = static_cast<uint16_t>(std::stoi(arg(argc, argv, "--port", "5000")));
|
const auto port = static_cast<uint16_t>(std::stoi(arg(argc, argv, "--port", "5000")));
|
||||||
const auto equipment_yaml = arg(argc, argv, "--config", "/app/data/equipment.yaml");
|
// Defaults are relative to the current working directory so the
|
||||||
const auto state_yaml = arg(argc, argv, "--state-table", "/app/data/control_state.yaml");
|
// binary works both inside the docker image (WORKDIR=/app) and on a
|
||||||
|
// host build run from the repo root. Pass explicit --config etc.
|
||||||
|
// when running from anywhere else.
|
||||||
|
const auto equipment_yaml = arg(argc, argv, "--config", "data/equipment.yaml");
|
||||||
|
const auto state_yaml = arg(argc, argv, "--state-table", "data/control_state.yaml");
|
||||||
const auto pj_state_yaml = arg(argc, argv, "--pj-state-table",
|
const auto pj_state_yaml = arg(argc, argv, "--pj-state-table",
|
||||||
"/app/data/process_job_state.yaml");
|
"data/process_job_state.yaml");
|
||||||
const auto cj_state_yaml = arg(argc, argv, "--cj-state-table",
|
const auto cj_state_yaml = arg(argc, argv, "--cj-state-table",
|
||||||
"/app/data/control_job_state.yaml");
|
"data/control_job_state.yaml");
|
||||||
const auto spool_dir = arg(argc, argv, "--spool-dir", "");
|
const auto spool_dir = arg(argc, argv, "--spool-dir", "");
|
||||||
const bool validate_only = has_flag(argc, argv, "--validate-config");
|
const bool validate_only = has_flag(argc, argv, "--validate-config");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user