github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/storage/bucket/azure/config.go (about)

     1  package azure
     2  
     3  import (
     4  	"flag"
     5  
     6  	"github.com/grafana/dskit/flagext"
     7  
     8  	"github.com/grafana/loki/pkg/storage/bucket/http"
     9  )
    10  
    11  // Config holds the config options for an Azure backend
    12  type Config struct {
    13  	StorageAccountName string         `yaml:"account_name"`
    14  	StorageAccountKey  flagext.Secret `yaml:"account_key"`
    15  	ContainerName      string         `yaml:"container_name"`
    16  	Endpoint           string         `yaml:"endpoint_suffix"`
    17  	MaxRetries         int            `yaml:"max_retries"`
    18  
    19  	http.Config `yaml:"http"`
    20  }
    21  
    22  // RegisterFlags registers the flags for Azure storage
    23  func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
    24  	cfg.RegisterFlagsWithPrefix("", f)
    25  }
    26  
    27  // RegisterFlagsWithPrefix registers the flags for Azure storage
    28  func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
    29  	f.StringVar(&cfg.StorageAccountName, prefix+"azure.account-name", "", "Azure storage account name")
    30  	f.Var(&cfg.StorageAccountKey, prefix+"azure.account-key", "Azure storage account key")
    31  	f.StringVar(&cfg.ContainerName, prefix+"azure.container-name", "loki", "Azure storage container name")
    32  	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")
    33  	f.IntVar(&cfg.MaxRetries, prefix+"azure.max-retries", 20, "Number of retries for recoverable errors")
    34  	cfg.Config.RegisterFlagsWithPrefix(prefix+"azure.", f)
    35  }