Skip to content

refactor: simplify web backend priority detection - #4036

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-b2abefdf
Mar 30, 2026
Merged

refactor: simplify web backend priority detection#4036
teknium1 merged 2 commits into
mainfrom
hermes/hermes-b2abefdf

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Replaces the cascading if has_X and not has_Y and not has_Z boolean chain in _get_backend() with a priority-ordered loop:

for backend, keys in [
    ("firecrawl", ("FIRECRAWL_API_KEY", "FIRECRAWL_API_URL")),
    ("parallel",  ("PARALLEL_API_KEY",)),
    ("tavily",    ("TAVILY_API_KEY",)),
    ("exa",       ("EXA_API_KEY",)),
]:
    if any(_has_env(k) for k in keys):
        return backend

Same behavior — verified against all 16 env var combinations. Half the lines, trivially extensible for new backends.

aydnOktay and others added 2 commits March 30, 2026 13:22
Replace cascading boolean conditions with a priority-ordered loop.
Same behavior (verified against all 16 env var combinations),
half the lines, trivially extensible for new backends.
@teknium1
teknium1 merged commit 0d10035 into main Mar 30, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
* fix(gateway): honor default for invalid bool-like config values

* refactor: simplify web backend priority detection

Replace cascading boolean conditions with a priority-ordered loop.
Same behavior (verified against all 16 env var combinations),
half the lines, trivially extensible for new backends.

---------

Co-authored-by: aydnOktay <xaydinoktay@gmail.com>
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
* fix(gateway): honor default for invalid bool-like config values

* refactor: simplify web backend priority detection

Replace cascading boolean conditions with a priority-ordered loop.
Same behavior (verified against all 16 env var combinations),
half the lines, trivially extensible for new backends.

---------

Co-authored-by: aydnOktay <xaydinoktay@gmail.com>
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
* fix(gateway): honor default for invalid bool-like config values

* refactor: simplify web backend priority detection

Replace cascading boolean conditions with a priority-ordered loop.
Same behavior (verified against all 16 env var combinations),
half the lines, trivially extensible for new backends.

---------

Co-authored-by: aydnOktay <xaydinoktay@gmail.com>
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
* fix(gateway): honor default for invalid bool-like config values

* refactor: simplify web backend priority detection

Replace cascading boolean conditions with a priority-ordered loop.
Same behavior (verified against all 16 env var combinations),
half the lines, trivially extensible for new backends.

---------

Co-authored-by: aydnOktay <xaydinoktay@gmail.com>
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