Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultExporter = struct { Format string LogFormat string FileName string CsvFormat string FlushInterval time.Duration MaxEventInMemory int64 }{ Format: "JSON", LogFormat: "[{{ .FormattedDate}}] user=\"{{ .UserKey}}\", flag=\"{{ .Key}}\", value=\"{{ .Value}}\"", FileName: "flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}", CsvFormat: "{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};" + "{{ .Value}};{{ .Default}}\\n", FlushInterval: 60000 * time.Millisecond, MaxEventInMemory: 100000, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ListenPort (optional) is the port we are using to start the proxy ListenPort int `mapstructure:"listen"` // HideBanner (optional) if true, we don't display the go-feature-flag relay proxy banner HideBanner bool `mapstructure:"hideBanner"` // EnableSwagger (optional) to have access to the swagger EnableSwagger bool `mapstructure:"enableSwagger"` // Host should be set if you are using swagger (default is localhost) Host string `mapstructure:"host"` // Debug (optional) if true, go-feature-flag relay proxy will run on debug mode, with more logs and custom responses Debug bool `mapstructure:"debug"` // PollingInterval (optional) Poll every X time // The minimum possible is 1 second // Default: 60 seconds PollingInterval int `mapstructure:"pollingInterval"` // FileFormat (optional) is the format of the file to retrieve (available YAML, TOML and JSON) // Default: YAML FileFormat string `mapstructure:"fileFormat"` // StartWithRetrieverError (optional) If true, the relay proxy will start even if we did not get any flags from // the retriever. It will serve only default values until the retriever returns the flags. // The init method will not return any error if the flag file is unreachable. // Default: false StartWithRetrieverError bool `mapstructure:"startWithRetrieverError"` // Retriever is the configuration on how to retrieve the file Retriever *RetrieverConf `mapstructure:"retriever"` // Retrievers is the exact same things than Retriever but allows to give more than 1 retriever at the time. // We are dealing with config files in order, if you have the same flag name in multiple files it will be override // based of the order of the retrievers in the slice. // // Note: If both Retriever and Retrievers are set, we will start by calling the Retriever and, // after we will use the order of Retrievers. Retrievers *[]RetrieverConf `mapstructure:"retrievers"` // Exporter is the configuration on how to export data Exporter *ExporterConf `mapstructure:"exporter"` // Notifiers is the configuration on where to notify a flag change Notifiers []NotifierConf `mapstructure:"notifier"` // RestAPITimeout is the timeout on the API. RestAPITimeout int `mapstructure:"restApiTimeout"` // Version is the version of the relay-proxy Version string // APIKeys list of API keys that authorized to use endpoints APIKeys []string `mapstructure:"apiKeys"` // contains filtered or unexported fields }
func ParseConfig ¶
ParseConfig is reading the configuration file
func (*Config) APIKeyExists ¶ added in v1.7.0
APIKeyExists is checking if an API Key exist in the relay proxy configuration
type ExporterConf ¶
type ExporterConf struct { Kind ExporterKind `mapstructure:"kind"` OutputDir string `mapstructure:"outputDir"` Format string `mapstructure:"format"` Filename string `mapstructure:"filename"` CsvTemplate string `mapstructure:"csvTemplate"` Bucket string `mapstructure:"bucket"` Path string `mapstructure:"path"` EndpointURL string `mapstructure:"endpointUrl"` Secret string `mapstructure:"secret"` Meta map[string]string `mapstructure:"meta"` LogFormat string `mapstructure:"logFormat"` FlushInterval int64 `mapstructure:"flushInterval"` MaxEventInMemory int64 `mapstructure:"maxEventInMemory"` }
ExporterConf contains all the field to configure an exporter
func (*ExporterConf) IsValid ¶
func (c *ExporterConf) IsValid() error
type ExporterKind ¶
type ExporterKind string
const ( FileExporter ExporterKind = "file" WebhookExporter ExporterKind = "webhook" LogExporter ExporterKind = "log" S3Exporter ExporterKind = "s3" GoogleStorageExporter ExporterKind = "googleStorage" )
func (ExporterKind) IsValid ¶
func (r ExporterKind) IsValid() error
IsValid is checking if the value is part of the enum
type NotifierConf ¶
type NotifierConf struct { Kind NotifierKind `mapstruct:"notifier"` SlackWebhookURL string `mapstruct:"slackWebhookUrl"` EndpointURL string `mapstruct:"endpointUrl"` Secret string `mapstruct:"secret"` Meta map[string]string `mapstruct:"meta"` }
func (*NotifierConf) IsValid ¶
func (c *NotifierConf) IsValid() error
type NotifierKind ¶
type NotifierKind string
const ( SlackNotifier NotifierKind = "slack" WebhookNotifier NotifierKind = "webhook" )
func (NotifierKind) IsValid ¶
func (r NotifierKind) IsValid() error
IsValid is checking if the value is part of the enum
type RetrieverConf ¶
type RetrieverConf struct { Kind RetrieverKind `mapstructure:"kind"` RepositorySlug string `mapstructure:"repositorySlug"` Branch string `mapstructure:"branch"` Path string `mapstructure:"path"` GithubToken string `mapstructure:"githubToken"` URL string `mapstructure:"url"` Timeout int64 `mapstructure:"timeout"` HTTPMethod string `mapstructure:"method"` HTTPBody string `mapstructure:"body"` HTTPHeaders map[string][]string `mapstructure:"headers"` Bucket string `mapstructure:"bucket"` Object string `mapstructure:"object"` Item string `mapstructure:"item"` Namespace string `mapstructure:"namespace"` ConfigMap string `mapstructure:"configmap"` Key string `mapstructure:"key"` }
RetrieverConf contains all the field to configure a retriever
func (*RetrieverConf) IsValid ¶
func (c *RetrieverConf) IsValid() error
IsValid validate the configuration of the retriever nolint:gocognit
type RetrieverKind ¶
type RetrieverKind string
RetrieverKind is an enum containing all accepted Retriever kind
const ( HTTPRetriever RetrieverKind = "http" GitHubRetriever RetrieverKind = "github" S3Retriever RetrieverKind = "s3" FileRetriever RetrieverKind = "file" GoogleStorageRetriever RetrieverKind = "googleStorage" KubernetesRetriever RetrieverKind = "configmap" )
func (RetrieverKind) IsValid ¶
func (r RetrieverKind) IsValid() error
IsValid is checking if the value is part of the enum
Click to show internal directories.
Click to hide internal directories.