github.com/grafana/pyroscope@v1.18.0/pkg/objstore/providers/swift/config.go (about) 1 // SPDX-License-Identifier: AGPL-3.0-only 2 // Provenance-includes-location: https://github.com/cortexproject/cortex/blob/master/pkg/storage/bucket/swift/config.go 3 // Provenance-includes-license: Apache-2.0 4 // Provenance-includes-copyright: The Cortex Authors. 5 6 package swift 7 8 import ( 9 "flag" 10 "time" 11 12 "github.com/grafana/dskit/flagext" 13 ) 14 15 // Config holds the config options for Swift backend 16 type Config struct { 17 AuthVersion int `yaml:"auth_version"` 18 AuthURL string `yaml:"auth_url"` 19 Username string `yaml:"username"` 20 UserDomainName string `yaml:"user_domain_name"` 21 UserDomainID string `yaml:"user_domain_id"` 22 UserID string `yaml:"user_id"` 23 Password flagext.Secret `yaml:"password"` 24 DomainID string `yaml:"domain_id"` 25 DomainName string `yaml:"domain_name"` 26 ProjectID string `yaml:"project_id"` 27 ProjectName string `yaml:"project_name"` 28 ProjectDomainID string `yaml:"project_domain_id"` 29 ProjectDomainName string `yaml:"project_domain_name"` 30 RegionName string `yaml:"region_name"` 31 ContainerName string `yaml:"container_name"` 32 MaxRetries int `yaml:"max_retries" category:"advanced"` 33 ConnectTimeout time.Duration `yaml:"connect_timeout" category:"advanced"` 34 RequestTimeout time.Duration `yaml:"request_timeout" category:"advanced"` 35 } 36 37 // RegisterFlags registers the flags for Swift storage 38 func (cfg *Config) RegisterFlags(f *flag.FlagSet) { 39 cfg.RegisterFlagsWithPrefix("", f) 40 } 41 42 // RegisterFlagsWithPrefix registers the flags for Swift storage with the provided prefix 43 func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { 44 f.IntVar(&cfg.AuthVersion, prefix+"swift.auth-version", 0, "OpenStack Swift authentication API version. 0 to autodetect.") 45 f.StringVar(&cfg.AuthURL, prefix+"swift.auth-url", "", "OpenStack Swift authentication URL") 46 f.StringVar(&cfg.Username, prefix+"swift.username", "", "OpenStack Swift username.") 47 f.StringVar(&cfg.UserDomainName, prefix+"swift.user-domain-name", "", "OpenStack Swift user's domain name.") 48 f.StringVar(&cfg.UserDomainID, prefix+"swift.user-domain-id", "", "OpenStack Swift user's domain ID.") 49 f.StringVar(&cfg.UserID, prefix+"swift.user-id", "", "OpenStack Swift user ID.") 50 f.Var(&cfg.Password, prefix+"swift.password", "OpenStack Swift API key.") 51 f.StringVar(&cfg.DomainID, prefix+"swift.domain-id", "", "OpenStack Swift user's domain ID.") 52 f.StringVar(&cfg.DomainName, prefix+"swift.domain-name", "", "OpenStack Swift user's domain name.") 53 f.StringVar(&cfg.ProjectID, prefix+"swift.project-id", "", "OpenStack Swift project ID (v2,v3 auth only).") 54 f.StringVar(&cfg.ProjectName, prefix+"swift.project-name", "", "OpenStack Swift project name (v2,v3 auth only).") 55 f.StringVar(&cfg.ProjectDomainID, prefix+"swift.project-domain-id", "", "ID of the OpenStack Swift project's domain (v3 auth only), only needed if it differs the from user domain.") 56 f.StringVar(&cfg.ProjectDomainName, prefix+"swift.project-domain-name", "", "Name of the OpenStack Swift project's domain (v3 auth only), only needed if it differs from the user domain.") 57 f.StringVar(&cfg.RegionName, prefix+"swift.region-name", "", "OpenStack Swift Region to use (v2,v3 auth only).") 58 f.StringVar(&cfg.ContainerName, prefix+"swift.container-name", "", "Name of the OpenStack Swift container to put chunks in.") 59 f.IntVar(&cfg.MaxRetries, prefix+"swift.max-retries", 3, "Max retries on requests error.") 60 f.DurationVar(&cfg.ConnectTimeout, prefix+"swift.connect-timeout", 10*time.Second, "Time after which a connection attempt is aborted.") 61 f.DurationVar(&cfg.RequestTimeout, prefix+"swift.request-timeout", 5*time.Second, "Time after which an idle request is aborted. The timeout watchdog is reset each time some data is received, so the timeout triggers after X time no data is received on a request.") 62 }