Skip to content

Read WORKERS in the systemd REST unit - #234

Closed
tomahawkeer wants to merge 1 commit into
smswithoutborders:mainfrom
tomahawkeer:fix/systemd-rest-workers
Closed

tomahawkeer wants to merge 1 commit into
smswithoutborders:mainfrom
tomahawkeer:fix/systemd-rest-workers

Conversation

@tomahawkeer

Copy link
Copy Markdown
Contributor

Fixes #221

relaysms-publisher-rest.service hard-coded --workers 4, while scripts/run.sh and the Docker entrypoint read WORKERS, so setting it in .env had no effect on server installs.

Changes

  • The unit sets Environment=WORKERS=4 as the default and passes --workers "${WORKERS}".
    • The issue suggested --workers "${WORKERS:-4}", but ExecStart= only supports ${VAR} / $VAR substitution, not shell-style defaults (systemd.service). Since EnvironmentFile= overrides Environment= (systemd.exec), a WORKERS line in .env still takes precedence.
  • tests/scripts/test_lib.py: test_rest_unit_reads_workers_with_a_default checks the rendered unit.
  • docs/configuration/settings.md: the WORKERS row notes that all three launchers read it from .env.

Testing

  • pytest tests/test_config.py tests/scripts/test_lib.py: 62 passed. The new test fails against the old unit.
  • systemd-analyze verify accepts the rendered unit.
  • ruff check / ruff format --check pass.
  • Run locally with a stub for the Rust-built lib_relaysms_payload_specs.generated module (not touched by this change). Not started under a live systemd.
  • Note: a WORKERS= line left empty in .env would override the default with an empty value, the same as HOST/PORT today. template.env ships it commented out, so the default applies.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FiGQujBCL8qnuH6bAv3Yiz

relaysms-publisher-rest.service hard-coded --workers 4, while
scripts/run.sh and the Docker entrypoint read WORKERS from the
environment, so setting WORKERS in .env had no effect on server installs.

systemd's ExecStart= supports ${VAR} but not shell-style ${VAR:-4}, so
the unit sets Environment=WORKERS=4 as the default and passes
--workers "${WORKERS}". EnvironmentFile= overrides Environment=, so a
WORKERS line in .env takes precedence.

Adds a render_units test and notes in the settings reference that all
three launchers read WORKERS from .env.

Fixes smswithoutborders#221

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FiGQujBCL8qnuH6bAv3Yiz
@github-actions github-actions Bot added the not-following-guidelines The PR doesn't follow CONTRIBUTING.md yet label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Thanks for the PR. It doesn't follow the contribution guide yet:

  • The PR targets main. Every PR targets staging: use Edit next to the title to change the base branch.

Also run the checks CI runs before you push. This comment updates when you push or edit the PR. Without activity, the PR is closed after 5 days.

@tomahawkeer

Copy link
Copy Markdown
Contributor Author

Superseded by a new PR against staging, per CONTRIBUTING.md. Sorry for the noise.

@tomahawkeer tomahawkeer closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-following-guidelines The PR doesn't follow CONTRIBUTING.md yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The systemd REST unit ignores WORKERS

1 participant