feat(searxng): configure endpoint via SEARXNG_URL env (#2499)

Add SEARXNG_URL runtime override for the built-in SearXNG web-search
provider, defaulting to http://localhost:8888/search. Enables Docker
and remote SearXNG deployments without changing existing behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zie
2026-07-10 11:29:06 +07:00
committed by decolua
co-authored by Cursor
parent b9e2611045
commit e79f9eddb4
5 changed files with 46 additions and 1 deletions
@@ -0,0 +1,30 @@
import { afterEach, describe, expect, it, vi } from "vitest";
const originalSearxngUrl = process.env.SEARXNG_URL;
async function loadProvider(url) {
if (url === undefined) delete process.env.SEARXNG_URL;
else process.env.SEARXNG_URL = url;
vi.resetModules();
return (await import("../../open-sse/providers/registry/searxng.js")).default;
}
afterEach(() => {
if (originalSearxngUrl === undefined) delete process.env.SEARXNG_URL;
else process.env.SEARXNG_URL = originalSearxngUrl;
vi.resetModules();
});
describe("SearXNG provider configuration", () => {
it("uses SEARXNG_URL when the deployment config supplies one", async () => {
const provider = await loadProvider("http://searxng:8080/search");
expect(provider.searchConfig.baseUrl).toBe("http://searxng:8080/search");
});
it("preserves the loopback default when SEARXNG_URL is unset", async () => {
const provider = await loadProvider(undefined);
expect(provider.searchConfig.baseUrl).toBe("http://localhost:8888/search");
});
});