fix(ecosia): wire proxy policy, validation, raw mode, and OpenAPI docs

This commit is contained in:
Rustem Kamalov
2026-05-05 02:47:47 +03:00
parent 718fad0542
commit 3eaa30118e
5 changed files with 10 additions and 6 deletions

View File

@@ -8,7 +8,7 @@
[![Docker Pulls](https://img.shields.io/docker/v/karust/openserp)](https://hub.docker.com/repository/docker/karust/openserp)
[![CI](https://github.com/karust/openserp/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/karust/openserp/actions/workflows/ci.yml)
**OpenSERP** is an API and CLI for accessing search engine results from **Google, Yandex, Baidu, Bing, and DuckDuckGo**.
**OpenSERP** is an API and CLI for accessing search engine results from **Google, Yandex, Baidu, Bing, DuckDuckGo, and Ecosia**.
A developer-friendly alternative to paid SERP API services!
**Official website:** [openserp.org](https://openserp.org)
@@ -53,7 +53,7 @@ go build -o openserp .
## Search Endpoints
Available engine names: `google`, `yandex`, `baidu`, `bing`, `duckduckgo`.
Available engine names: `google`, `yandex`, `baidu`, `bing`, `duckduckgo`, `ecosia`.
Dedicated engine endpoints:

View File

@@ -13,6 +13,7 @@ func buildEngineProxyPolicyMap() map[string]string {
"baidu": config.BaiduConfig.Proxy,
"bing": config.BingConfig.Proxy,
"duckduckgo": config.DuckDuckGoConfig.Proxy,
"ecosia": config.EcosiaConfig.Proxy,
}
}

View File

@@ -16,7 +16,7 @@ import (
)
const (
version = "0.7.7"
version = "0.7.8"
defaultConfigFilename = "config"
envPrefix = "OPENSERP"
)
@@ -317,7 +317,7 @@ func initializeConfig(cmd *cobra.Command) error {
}
func validateEngineProxyTags(v *viper.Viper) error {
for _, engineName := range []string{"google", "yandex", "baidu", "bing", "duckduckgo"} {
for _, engineName := range []string{"google", "yandex", "baidu", "bing", "duckduckgo", "ecosia"} {
key := engineName + ".proxy"
if !v.IsSet(key) {
continue

View File

@@ -39,6 +39,8 @@ func (r *rawEngine) Search(ctx context.Context, q core.Query) ([]core.SearchResu
return yandex.Search(ctx, q)
case "baidu":
return baidu.Search(ctx, q)
case "ecosia":
return ecosia.Search(ctx, q)
default:
return nil, fmt.Errorf("unsupported engine: %s", r.name)
}
@@ -102,6 +104,7 @@ func serve(cmd *cobra.Command, args []string) {
&rawEngine{name: "google"},
&rawEngine{name: "yandex"},
&rawEngine{name: "baidu"},
&rawEngine{name: "ecosia"},
)
if err := listenWithGracefulShutdown(serv, nil); err != nil {
logrus.Error(err)

View File

@@ -32,7 +32,7 @@ paths:
operationId: searchWeb
summary: Search web results from a specific engine
description: >
Engine path values are `google`, `yandex`, `baidu`, `bing`, and `duck`
Engine path values are `google`, `yandex`, `baidu`, `bing`, `duck`, and `ecosia`
(`duck` maps to DuckDuckGo internally). Use `?format=markdown|text|ndjson`
for alternative output formats.
parameters:
@@ -487,7 +487,7 @@ components:
description: Search engine endpoint alias (`duck` is DuckDuckGo).
schema:
type: string
enum: [google, yandex, baidu, bing, duck]
enum: [google, yandex, baidu, bing, duck, ecosia]
TextQuery:
name: text
in: query