github.com/grafana/pyroscope@v1.18.0/pkg/objstore/providers/filesystem/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/filesystem/config.go 3 // Provenance-includes-license: Apache-2.0 4 // Provenance-includes-copyright: The Cortex Authors. 5 6 package filesystem 7 8 import "flag" 9 10 // Config stores the configuration for storing and accessing objects in the local filesystem. 11 type Config struct { 12 Directory string `yaml:"dir"` 13 } 14 15 // RegisterFlags registers the flags for filesystem storage 16 func (cfg *Config) RegisterFlags(f *flag.FlagSet) { 17 cfg.RegisterFlagsWithPrefix("", f) 18 } 19 20 // RegisterFlagsWithPrefixAndDefaultDirectory registers the flags for filesystem 21 // storage with the provided prefix and sets the default directory to dir. 22 func (cfg *Config) RegisterFlagsWithPrefixAndDefaultDirectory(prefix, dir string, f *flag.FlagSet) { 23 f.StringVar(&cfg.Directory, prefix+"filesystem.dir", dir, "Local filesystem storage directory.") 24 } 25 26 // RegisterFlagsWithPrefix registers the flags for filesystem storage with the provided prefix 27 func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { 28 cfg.RegisterFlagsWithPrefixAndDefaultDirectory(prefix, "", f) 29 }