mirror of
https://github.com/karust/openserp.git
synced 2026-09-08 20:46:23 +08:00
fix(ecosia): wire proxy policy, validation, raw mode, and OpenAPI docs
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user