github.com/grafana/pyroscope@v1.18.0/pkg/objstore/providers/azure/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/azure/config.go 3 // Provenance-includes-license: Apache-2.0 4 // Provenance-includes-copyright: The Cortex Authors. 5 6 package azure 7 8 import ( 9 "flag" 10 11 "github.com/grafana/dskit/flagext" 12 ) 13 14 // Config holds the config options for an Azure backend 15 type Config struct { 16 AzTenantID string `yaml:"az_tenant_id"` 17 ClientID string `yaml:"client_id"` 18 ClientSecret flagext.Secret `yaml:"client_secret"` 19 StorageAccountName string `yaml:"account_name"` 20 StorageAccountKey flagext.Secret `yaml:"account_key"` 21 StorageConnectionString flagext.Secret `yaml:"connection_string"` 22 ContainerName string `yaml:"container_name"` 23 Endpoint string `yaml:"endpoint_suffix"` 24 MaxRetries int `yaml:"max_retries" category:"advanced"` 25 UserAssignedID string `yaml:"user_assigned_id" category:"advanced"` 26 } 27 28 // RegisterFlags registers the flags for Azure storage 29 func (cfg *Config) RegisterFlags(f *flag.FlagSet) { 30 cfg.RegisterFlagsWithPrefix("", f) 31 } 32 33 // RegisterFlagsWithPrefix registers the flags for Azure storage 34 func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { 35 f.StringVar(&cfg.AzTenantID, prefix+"azure.az-tenant-id", "", "Azure Active Directory tenant ID. If set alongside `client-id` and `client-secret`, these values will be used for authentication via a client secret credential.") 36 f.StringVar(&cfg.ClientID, prefix+"azure.client-id", "", "Azure Active Directory client ID. If set alongside `az-tenant-id` and `client-secret`, these values will be used for authentication via a client secret credential.") 37 f.Var(&cfg.ClientSecret, prefix+"azure.client-secret", "Azure Active Directory client secret. If set alongside `az-tenant-id` and `client-id`, these values will be used for authentication via a client secret credential.") 38 f.StringVar(&cfg.StorageAccountName, prefix+"azure.account-name", "", "Azure storage account name") 39 f.Var(&cfg.StorageAccountKey, prefix+"azure.account-key", "Azure storage account key. If unset, Azure managed identities will be used for authentication instead.") 40 f.Var(&cfg.StorageConnectionString, prefix+"azure.connection-string", "If `connection-string` is set, the value of `endpoint-suffix` will not be used. Use this method over `account-key` if you need to authenticate via a SAS token. Or if you use the Azurite emulator.") 41 f.StringVar(&cfg.ContainerName, prefix+"azure.container-name", "", "Azure storage container name") 42 f.StringVar(&cfg.Endpoint, prefix+"azure.endpoint-suffix", "", "Azure storage endpoint suffix without schema. The account name will be prefixed to this value to create the FQDN. If set to empty string, default endpoint suffix is used.") 43 f.IntVar(&cfg.MaxRetries, prefix+"azure.max-retries", 3, "Number of retries for recoverable errors") 44 f.StringVar(&cfg.UserAssignedID, prefix+"azure.user-assigned-id", "", "User assigned managed identity. If empty, then System assigned identity is used.") 45 }