Skip to content

feat(serverd): read settings from an openads.ini via --config#88

Merged
Admnwk merged 1 commit into
FiveTechSoft:mainfrom
Admnwk:feat/serverd-config-file
Jun 26, 2026
Merged

feat(serverd): read settings from an openads.ini via --config#88
Admnwk merged 1 commit into
FiveTechSoft:mainfrom
Admnwk:feat/serverd-config-file

Conversation

@Admnwk

@Admnwk Admnwk commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

What & why

Ex-Advantage users expect to keep server settings in a config file (ADS shipped ads.cfg) rather than a long command line baked into a service binPath. This adds a dependency-free INI parser and a --config <path> flag to openads_serverd.

Recognised keys map 1:1 to the existing CLI options:
host, port, backlog, http_port, data, http_user (repeatable user:password).

Precedence is defaults < config file < command line — an explicit flag always wins over the file. Both the interactive path and the Windows service path resolve args through the same loader, so a service registered with --config openads.ini reloads its settings from the file on every start.

This is the foundation for a --setup wizard (separate PR, stacked) that writes such a file.

Design notes

  • tools/serverd/config_ini.{h,cpp}: parse_ini / load_ini_file. Pure C++17 (std::ifstream/istringstream) — works identically on Windows/Linux/macOS, no new dependency. Tolerates CRLF, #/; comments and an optional [server] header; rejects unknown keys and out-of-range ports with a line-numbered message.
  • tools/serverd/main.cpp: --config plumbing (apply_ini + load_config_and_args) + help text.
  • openads.ini.sample: documented template.

Validation

  • New unit tests tests/unit/serverd_config_ini_test.cpp: 11 cases / 42 assertions covering every key, the has_* precedence flags, dash/underscore aliases, comments, CRLF and all error paths.
  • Full suite 795/795, 0 failed (MSVC x64, RelWithDebInfo, -Werror ON).
  • Smoke: --config openads.ini drives the bind; a later --port N on the same line overrides the file; --http-port from the file starts Studio.

Coordination

Touches tools/serverd/ only (not ace_exports.cpp / the wire). Opening as a PR for @FiveTechSoft / Antonio to review and merge.

Ex-Advantage users expect to keep server settings in a config file
(ADS shipped ads.cfg) rather than a long command line baked into a
service binPath. Add a dependency-free INI parser and a --config
<path> flag.

Recognised keys map 1:1 to the existing CLI options: host, port,
backlog, http_port, data, http_user (repeatable user:password).
Precedence is defaults < config file < command line, so an explicit
flag always wins over the file. Both the interactive path and the
Windows service path resolve args through the same loader.

- tools/serverd/config_ini.{h,cpp}: parse_ini / load_ini_file. Pure
  C++17 (std::fstream/istringstream), works identically on
  Windows/Linux/macOS. Tolerates CRLF, #/; comments and an optional
  [server] header; rejects unknown keys and out-of-range ports with a
  line-numbered message.
- tools/serverd/main.cpp: --config plumbing (apply_ini +
  load_config_and_args), help text.
- tests/unit/serverd_config_ini_test.cpp: 11 cases / 42 assertions
  covering every key, the has_* flags, aliases, comments, CRLF and the
  error paths.
- openads.ini.sample: documented template.

Suite 795/795, 0 regression. Smoke: --config drives the bind and a
later --port overrides the file.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a minimal INI configuration parser for the OpenADS server daemon, allowing settings to be loaded from an openads.ini file via a new --config command-line flag. It includes a sample configuration file, comprehensive unit tests for the parser, and integrates the parser into the main server daemon executable so that command-line arguments override the INI file settings. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Admnwk Admnwk merged commit 9f2ccd5 into FiveTechSoft:main Jun 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant