github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/storage/bucket/gcs/config.go (about)

     1  package gcs
     2  
     3  import (
     4  	"flag"
     5  
     6  	"github.com/grafana/dskit/flagext"
     7  )
     8  
     9  // Config holds the config options for GCS backend
    10  type Config struct {
    11  	BucketName     string         `yaml:"bucket_name"`
    12  	ServiceAccount flagext.Secret `yaml:"service_account"`
    13  }
    14  
    15  // RegisterFlags registers the flags for GCS storage
    16  func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
    17  	cfg.RegisterFlagsWithPrefix("", f)
    18  }
    19  
    20  // RegisterFlagsWithPrefix registers the flags for GCS storage with the provided prefix
    21  func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
    22  	f.StringVar(&cfg.BucketName, prefix+"gcs.bucket-name", "", "GCS bucket name")
    23  	f.Var(&cfg.ServiceAccount, prefix+"gcs.service-account", "JSON representing either a Google Developers Console client_credentials.json file or a Google Developers service account key file. If empty, fallback to Google default logic.")
    24  }