Skip to content

feat: add configurable timeout#23

Merged
dgunzy merged 1 commit into
mainfrom
timeout-flag
May 29, 2026
Merged

feat: add configurable timeout#23
dgunzy merged 1 commit into
mainfrom
timeout-flag

Conversation

@dgunzy

@dgunzy dgunzy commented May 29, 2026

Copy link
Copy Markdown
Contributor

Signed-off-by: Daniel Guns danbguns@gmail.com

Add configurable --timeout flag for Apache request timeout

What changed

  • forevd/apache/httpd.conf — replaced hardcoded Timeout 10 with
    Timeout {{ timeout }} and moved the httpd_include block to render
    after the Timeout directive.

  • forevd/__main__.py — added --timeout CLI option (int, default 10,
    env var FOREVD_TIMEOUT) and wired it through to the config dict.

  • tests/test_apache_template.py — new; 8 tests covering template
    rendering for various timeout values and the httpd_include ordering.

  • tests/test_main.py — new; 10 tests covering the full precedence
    chain via Click's CliRunner.

Precedence (highest → lowest)

Tier Mechanism
1 httpd_include file containing a Timeout directive (Apache last-directive-wins)
2 --timeout CLI flag
3 FOREVD_TIMEOUT environment variable
4 Built-in default — 10 s

Why httpd_include wins over --timeout

Apache uses the last occurrence of a repeated global directive.
By rendering httpd_include after Timeout {{ timeout }} in the
template, any Timeout line in the user's include file naturally
shadows the flag value — no special logic required.

@bradpenney bradpenney 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.

Looks good!

Signed-off-by: Daniel Guns <danbguns@gmail.com>
@dgunzy dgunzy merged commit 59f7c61 into main May 29, 2026
5 checks passed
@dgunzy dgunzy deleted the timeout-flag branch May 29, 2026 16:08
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.

2 participants