From 288b76d955a506e14b201c6ee3d856b4b98f3868 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Tue, 19 Jul 2022 16:15:24 +0200 Subject: [PATCH] Add config for setting search_min_length capability This adds the "search_min_length" setting to the frontend service which allows to set the search_min_length capabilty which is e.g. used by web. Partial: #547 --- services/frontend/pkg/config/config.go | 1 + services/frontend/pkg/config/defaults/defaultconfig.go | 1 + services/frontend/pkg/revaconfig/config.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index 3d8cef6b1..136d11d09 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -32,6 +32,7 @@ type Config struct { UploadHTTPMethodOverride string `yaml:"upload_http_method_override" env:"FRONTEND_UPLOAD_HTTP_METHOD_OVERRIDE" desc:"Advise TUS to replace PATCH requests by POST requests."` DefaultUploadProtocol string `yaml:"default_upload_protocol" env:"FRONTEND_DEFAULT_UPLOAD_PROTOCOL" desc:"The default upload protocol to use in the frontend (e.g. tus)."` EnableResharing bool `yaml:"enable_resharing" env:"FRONTEND_ENABLE_RESHARING" desc:"Enables the support for resharing in the frontend."` + SearchMinLength int `yaml:"search_min_length" env:"FRONTEND_SEARCH_MIN_LENGTH" desc:"Minimum number of characters to enter before starting a search for Sharees."` PublicURL string `yaml:"public_url" env:"OCIS_URL;FRONTEND_PUBLIC_URL" desc:"The public facing URL of the oCIS frontend."` diff --git a/services/frontend/pkg/config/defaults/defaultconfig.go b/services/frontend/pkg/config/defaults/defaultconfig.go index f23891d14..4cd1ea94d 100644 --- a/services/frontend/pkg/config/defaults/defaultconfig.go +++ b/services/frontend/pkg/config/defaults/defaultconfig.go @@ -39,6 +39,7 @@ func DefaultConfig() *config.Config { UploadHTTPMethodOverride: "", DefaultUploadProtocol: "tus", EnableResharing: true, + SearchMinLength: 3, Checksums: config.Checksums{ SupportedTypes: []string{"sha1", "md5", "adler32"}, PreferredUploadType: "", diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 7b13c3bfb..16a94e06f 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -165,7 +165,7 @@ func FrontendConfigFromStruct(cfg *config.Config) map[string]interface{} { "share_with_group_members_only": true, "share_with_membership_groups_only": true, "default_permissions": 22, - "search_min_length": 3, + "search_min_length": cfg.SearchMinLength, "public": map[string]interface{}{ "alias": true, "enabled": true,