Cleanup and improve the caching config (#6148)
* Cleanup and improve the caching config * bump reva Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * disable stat cache Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * Bump reva * Linter fixes --------- Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
co-authored by
Jörn Friedrich Dreyer
parent
d563b63d8f
commit
129489203b
@@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
)
|
||||
@@ -123,12 +124,12 @@ type OCS struct {
|
||||
SharePrefix string `yaml:"share_prefix" env:"FRONTEND_OCS_SHARE_PREFIX" desc:"Path prefix for shares as part of an ocis resource. Note that the path must start with '/'."`
|
||||
HomeNamespace string `yaml:"home_namespace" env:"FRONTEND_OCS_PERSONAL_NAMESPACE;FRONTEND_OCS_HOME_NAMESPACE" desc:"Homespace namespace identifier." deprecationVersion:"3.0" removalVersion:"4.0.0" deprecationInfo:"FRONTEND_OCS_HOME_NAMESPACE changing name for consistency" deprecationReplacement:"FRONTEND_OCS_PERSONAL_NAMESPACE"`
|
||||
AdditionalInfoAttribute string `yaml:"additional_info_attribute" env:"FRONTEND_OCS_ADDITIONAL_INFO_ATTRIBUTE" desc:"Additional information attribute for the user like {{.Mail}}."`
|
||||
ResourceInfoCacheType string `yaml:"resource_info_cache_type" env:"OCIS_CACHE_STORE;FRONTEND_OCS_RESOURCE_INFO_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."`
|
||||
ResourceInfoCacheNodes []string `yaml:"resource_info_cache_nodes" env:"OCIS_CACHE_STORE_NODES;FRONTEND_OCS_RESOURCE_INFO_CACHE_STORE_NODES" desc:"A comma separated list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store."`
|
||||
ResourceInfoCacheDatabase string `yaml:"resource_info_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."`
|
||||
ResourceInfoCacheTable string `yaml:"resource_info_cache_table" env:"FRONTEND_OCS_RESOURCE_INFO_CACHE_TABLE" desc:"The database table the store should use."`
|
||||
ResourceInfoCacheTTL int `yaml:"resource_info_cache_ttl" env:"OCIS_CACHE_TTL;FRONTEND_OCS_RESOURCE_INFO_CACHE_TTL" desc:"Max TTL in seconds for the resource info cache."`
|
||||
ResourceInfoCacheSize int `yaml:"resource_info_cache_size" env:"OCIS_CACHE_SIZE;FRONTEND_OCS_RESOURCE_INFO_CACHE_SIZE" desc:"Max number of entries to hold in the cache."`
|
||||
StatCacheType string `yaml:"stat_cache_type" env:"OCIS_CACHE_STORE;FRONTEND_OCS_STAT_CACHE_STORE" desc:"The type of the cache store. Supported values are: 'memory', 'ocmem', 'etcd', 'redis', 'redis-sentinel', 'nats-js', 'noop'. See the text description for details."`
|
||||
StatCacheNodes []string `yaml:"stat_cache_nodes" env:"OCIS_CACHE_STORE_NODES;FRONTEND_OCS_STAT_CACHE_STORE_NODES" desc:"A comma separated list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store."`
|
||||
StatCacheDatabase string `yaml:"stat_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use."`
|
||||
StatCacheTable string `yaml:"stat_cache_table" env:"FRONTEND_OCS_STAT_CACHE_TABLE" desc:"The database table the store should use."`
|
||||
StatCacheTTL time.Duration `yaml:"stat_cache_ttl" env:"OCIS_CACHE_TTL;FRONTEND_OCS_STAT_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. The duration can be set as number followed by a unit identifier like s, m or h. Defaults to '300s' (300 seconds)."`
|
||||
StatCacheSize int `yaml:"stat_cache_size" env:"OCIS_CACHE_SIZE;FRONTEND_OCS_STAT_CACHE_SIZE" desc:"Max number of entries to hold in the cache."`
|
||||
CacheWarmupDriver string `yaml:"cache_warmup_driver,omitempty"` // not supported by the oCIS product, therefore not part of docs
|
||||
CacheWarmupDrivers CacheWarmupDrivers `yaml:"cache_warmup_drivers,omitempty"` // not supported by the oCIS product, therefore not part of docs
|
||||
EnableDenials bool `yaml:"enable_denials" env:"FRONTEND_OCS_ENABLE_DENIALS" desc:"EXPERIMENTAL: enable the feature to deny access on folders."`
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package defaults
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/structs"
|
||||
"github.com/owncloud/ocis/v2/services/frontend/pkg/config"
|
||||
@@ -102,13 +104,13 @@ func DefaultConfig() *config.Config {
|
||||
Prefix: "data",
|
||||
},
|
||||
OCS: config.OCS{
|
||||
Prefix: "ocs",
|
||||
SharePrefix: "/Shares",
|
||||
HomeNamespace: "/users/{{.Id.OpaqueId}}",
|
||||
AdditionalInfoAttribute: "{{.Mail}}",
|
||||
ResourceInfoCacheType: "memory",
|
||||
ResourceInfoCacheDatabase: "ocis",
|
||||
ResourceInfoCacheTTL: 0,
|
||||
Prefix: "ocs",
|
||||
SharePrefix: "/Shares",
|
||||
HomeNamespace: "/users/{{.Id.OpaqueId}}",
|
||||
AdditionalInfoAttribute: "{{.Mail}}",
|
||||
StatCacheType: "noop",
|
||||
StatCacheDatabase: "ocis",
|
||||
StatCacheTTL: 300 * time.Second,
|
||||
},
|
||||
Middleware: config.Middleware{
|
||||
Auth: config.Auth{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"net/url"
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
"github.com/owncloud/ocis/v2/services/frontend/pkg/config"
|
||||
@@ -146,20 +147,20 @@ func FrontendConfigFromStruct(cfg *config.Config) (map[string]interface{}, error
|
||||
"insecure": true,
|
||||
},
|
||||
"ocs": map[string]interface{}{
|
||||
"storage_registry_svc": cfg.Reva.Address,
|
||||
"share_prefix": cfg.OCS.SharePrefix,
|
||||
"home_namespace": cfg.OCS.HomeNamespace,
|
||||
"resource_info_cache_ttl": cfg.OCS.ResourceInfoCacheTTL,
|
||||
"resource_info_cache_size": cfg.OCS.ResourceInfoCacheSize,
|
||||
"resource_info_cache_store": cfg.OCS.ResourceInfoCacheType,
|
||||
"resource_info_cache_nodes": cfg.OCS.ResourceInfoCacheNodes,
|
||||
"resource_info_cache_database": cfg.OCS.ResourceInfoCacheDatabase,
|
||||
"resource_info_cache_table": cfg.OCS.ResourceInfoCacheTable,
|
||||
"prefix": cfg.OCS.Prefix,
|
||||
"additional_info_attribute": cfg.OCS.AdditionalInfoAttribute,
|
||||
"machine_auth_apikey": cfg.MachineAuthAPIKey,
|
||||
"enable_denials": cfg.OCS.EnableDenials,
|
||||
"cache_warmup_driver": cfg.OCS.CacheWarmupDriver,
|
||||
"storage_registry_svc": cfg.Reva.Address,
|
||||
"share_prefix": cfg.OCS.SharePrefix,
|
||||
"home_namespace": cfg.OCS.HomeNamespace,
|
||||
"stat_cache_ttl": cfg.OCS.StatCacheTTL / time.Second,
|
||||
"stat_cache_size": cfg.OCS.StatCacheSize,
|
||||
"stat_cache_store": cfg.OCS.StatCacheType,
|
||||
"stat_cache_nodes": cfg.OCS.StatCacheNodes,
|
||||
"stat_cache_database": cfg.OCS.StatCacheDatabase,
|
||||
"stat_cache_table": cfg.OCS.StatCacheTable,
|
||||
"prefix": cfg.OCS.Prefix,
|
||||
"additional_info_attribute": cfg.OCS.AdditionalInfoAttribute,
|
||||
"machine_auth_apikey": cfg.MachineAuthAPIKey,
|
||||
"enable_denials": cfg.OCS.EnableDenials,
|
||||
"cache_warmup_driver": cfg.OCS.CacheWarmupDriver,
|
||||
"cache_warmup_drivers": map[string]interface{}{
|
||||
"cbox": map[string]interface{}{
|
||||
"db_username": cfg.OCS.CacheWarmupDrivers.CBOX.DBUsername,
|
||||
|
||||
Reference in New Issue
Block a user