config

package
v1.42.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabaseStorageType = StorageType("database")
	LocalStorageType    = StorageType("local")
	GitStorageType      = StorageType("git")
	ObjectStorageType   = StorageType("object")
	OCIStorageType      = StorageType("oci")
)
View Source
const (
	S3ObjectSubStorageType     = ObjectSubStorageType("s3")
	AZBlobObjectSubStorageType = ObjectSubStorageType("azblob")
	GSBlobObjectSubStorageType = ObjectSubStorageType("googlecloud")
)
View Source
const (
	SystemUITheme = UITheme("system")
	DarkUITheme   = UITheme("dark")
	LightUITheme  = UITheme("light")
)
View Source
const EnvPrefix = "FLIPT"
View Source
const Version = "1.0"

Variables

View Source
var DecodeHooks = []mapstructure.DecodeHookFunc{
	mapstructure.StringToTimeDurationHookFunc(),
	stringToSliceHookFunc(),
	stringToEnumHookFunc(stringToLogEncoding),
	stringToEnumHookFunc(stringToCacheBackend),
	stringToEnumHookFunc(stringToTracingExporter),
	stringToEnumHookFunc(stringToScheme),
	stringToEnumHookFunc(stringToDatabaseProtocol),
	stringToEnumHookFunc(stringToAuthMethod),
}

Functions

func DefaultBundleDir added in v1.31.0

func DefaultBundleDir() (string, error)

func Dir added in v1.31.0

func Dir() (string, error)

Dir returns the default root directory for Flipt configuration

Types

type AZBlob added in v1.34.0

type AZBlob struct {
	Endpoint     string        `json:"-" mapstructure:"endpoint" yaml:"endpoint,omitempty"`
	Container    string        `json:"container,omitempty" mapstructure:"container" yaml:"container,omitempty"`
	PollInterval time.Duration `json:"pollInterval,omitempty" mapstructure:"poll_interval" yaml:"poll_interval,omitempty"`
}

AZBlob contains configuration for referencing a Azure Blob Storage

type AnalyticsConfig added in v1.37.0

type AnalyticsConfig struct {
	Storage AnalyticsStorageConfig `json:"storage,omitempty" mapstructure:"storage" yaml:"storage,omitempty"`
	Buffer  BufferConfig           `json:"buffer,omitempty" mapstructure:"buffer" yaml:"buffer,omitempty"`
}

AnalyticsConfig defines the configuration for various mechanisms for reporting and querying analytical data for Flipt.

func (*AnalyticsConfig) Enabled added in v1.37.0

func (a *AnalyticsConfig) Enabled() bool

type AnalyticsStorageConfig added in v1.37.0

type AnalyticsStorageConfig struct {
	Clickhouse ClickhouseConfig `json:"clickhouse,omitempty" mapstructure:"clickhouse" yaml:"clickhouse,omitempty"`
}

AnalyticsStorageConfig is a collection of configuration option for storage backends.

func (*AnalyticsStorageConfig) String added in v1.39.0

func (a *AnalyticsStorageConfig) String() string

type AuditConfig added in v1.21.0

type AuditConfig struct {
	Sinks  SinksConfig  `json:"sinks,omitempty" mapstructure:"sinks" yaml:"sinks,omitempty"`
	Buffer BufferConfig `json:"buffer,omitempty" mapstructure:"buffer" yaml:"buffer,omitempty"`
	Events []string     `json:"events,omitempty" mapstructure:"events" yaml:"events,omitempty"`
}

AuditConfig contains fields, which enable and configure Flipt's various audit sink mechanisms.

func (AuditConfig) Enabled added in v1.23.0

func (c AuditConfig) Enabled() bool

Enabled returns true if any nested sink is enabled

func (AuditConfig) IsZero added in v1.28.0

func (c AuditConfig) IsZero() bool

type Authentication added in v1.23.0

type Authentication struct {
	BasicAuth *BasicAuth `json:"-" mapstructure:"basic,omitempty" yaml:"-"`
	TokenAuth *TokenAuth `json:"-" mapstructure:"token,omitempty" yaml:"-"`
	SSHAuth   *SSHAuth   `json:"-" mapstructure:"ssh,omitempty" yaml:"-"`
}

Authentication holds structures for various types of auth we support. Token auth will take priority over Basic auth if both are provided.

To make things easier, if there are multiple inputs that a particular auth method needs, and not all inputs are given but only partially, we will return a validation error. (e.g. if username for basic auth is given, and token is also given a validation error will be returned)

type AuthenticationCleanupSchedule added in v1.16.0

type AuthenticationCleanupSchedule struct {
	Interval    time.Duration `json:"interval,omitempty" mapstructure:"interval" yaml:"interval,omitempty"`
	GracePeriod time.Duration `json:"gracePeriod,omitempty" mapstructure:"grace_period" yaml:"grace_period,omitempty"`
}

AuthenticationCleanupSchedule is used to configure a cleanup goroutine.

type AuthenticationConfig added in v1.15.0

type AuthenticationConfig struct {
	// Required designates whether authentication credentials are validated.
	// If required == true, then authentication is required for all API endpoints.
	// Else, authentication is not required and Flipt's APIs are not secured.
	Required bool `json:"required" mapstructure:"required" yaml:"required"`

	// Exclude allows you to skip enforcing authentication on the different
	// top-level sections of the API.
	// By default, given required == true, the API is fully protected.
	Exclude struct {
		// Management refers to the section of the API with the prefix /api/v1
		Management bool `json:"management,omitempty" mapstructure:"management" yaml:"management,omitempty"`
		// Metadata refers to the section of the API with the prefix /meta
		Metadata bool `json:"metadata,omitempty" mapstructure:"metadata" yaml:"metadata,omitempty"`
		// Evaluation refers to the section of the API with the prefix /evaluation/v1
		Evaluation bool `json:"evaluation,omitempty" mapstructure:"evaluation" yaml:"evaluation,omitempty"`
	} `json:"exclude,omitempty" mapstructure:"exclude" yaml:"exclude,omitempty"`

	Session AuthenticationSession `json:"session,omitempty" mapstructure:"session" yaml:"session,omitempty"`
	Methods AuthenticationMethods `json:"methods,omitempty" mapstructure:"methods" yaml:"methods,omitempty"`
}

AuthenticationConfig configures Flipts authentication mechanisms

func (AuthenticationConfig) Enabled added in v1.23.0

func (c AuthenticationConfig) Enabled() bool

Enabled returns true if authentication is marked as required or any of the authentication methods are enabled.

func (AuthenticationConfig) IsZero added in v1.28.0

func (c AuthenticationConfig) IsZero() bool

IsZero returns true if the authentication config is not enabled. This is used for marshalling to YAML for `config init`.

func (AuthenticationConfig) RequiresDatabase added in v1.40.1

func (c AuthenticationConfig) RequiresDatabase() bool

RequiresDatabase returns true if any of the enabled authentication methods requires a database connection

func (*AuthenticationConfig) SessionEnabled added in v1.26.0

func (c *AuthenticationConfig) SessionEnabled() bool

func (AuthenticationConfig) ShouldRunCleanup added in v1.16.0

func (c AuthenticationConfig) ShouldRunCleanup() (shouldCleanup bool)

ShouldRunCleanup returns true if the cleanup background process should be started. It returns true given at-least 1 method is enabled and it's associated schedule has been configured (non-nil).

type AuthenticationMethod added in v1.17.0

type AuthenticationMethod[C AuthenticationMethodInfoProvider] struct {
	Method  C                              `mapstructure:",squash"`
	Enabled bool                           `json:"enabled,omitempty" mapstructure:"enabled" yaml:"enabled,omitempty"`
	Cleanup *AuthenticationCleanupSchedule `json:"cleanup,omitempty" mapstructure:"cleanup,omitempty" yaml:"cleanup,omitempty"`
}

AuthenticationMethod is a container for authentication methods. It describes the common properties of all authentication methods. Along with leaving a generic slot for the particular method to declare its own structural fields. This generic field (Method) must implement the AuthenticationMethodInfoProvider to be valid at compile time. nolint:musttag

type AuthenticationMethodCloudConfig added in v1.42.0

type AuthenticationMethodCloudConfig struct{}

type AuthenticationMethodGithubConfig added in v1.26.0

type AuthenticationMethodGithubConfig struct {
	ClientId             string              `json:"-" mapstructure:"client_id" yaml:"-"`
	ClientSecret         string              `json:"-" mapstructure:"client_secret" yaml:"-"`
	RedirectAddress      string              `json:"redirectAddress,omitempty" mapstructure:"redirect_address" yaml:"redirect_address,omitempty"`
	Scopes               []string            `json:"scopes,omitempty" mapstructure:"scopes" yaml:"scopes,omitempty"`
	AllowedOrganizations []string            `json:"allowedOrganizations,omitempty" mapstructure:"allowed_organizations" yaml:"allowed_organizations,omitempty"`
	AllowedTeams         map[string][]string `json:"allowedTeams,omitempty" mapstructure:"allowed_teams" yaml:"allowed_teams,omitempty"`
}

AuthenticationMethodGithubConfig contains configuration and information for completing an OAuth 2.0 flow with GitHub as a provider.

type AuthenticationMethodInfo added in v1.17.0

type AuthenticationMethodInfo struct {
	Method            auth.Method
	SessionCompatible bool
	RequiresDatabase  bool
	Metadata          *structpb.Struct
}

AuthenticationMethodInfo is a structure which describes properties of a particular authentication method. i.e. the name and whether or not the method is session compatible.

func (AuthenticationMethodInfo) Name added in v1.17.0

Name returns the friendly lower-case name for the authentication method.

type AuthenticationMethodInfoProvider added in v1.17.0

type AuthenticationMethodInfoProvider interface {
	// contains filtered or unexported methods
}

AuthenticationMethodInfoProvider is a type with a single method Info which returns an AuthenticationMethodInfo describing the underlying methods properties.

type AuthenticationMethodJWTConfig added in v1.35.0

type AuthenticationMethodJWTConfig struct {
	// ValidateClaims is used to validate the claims of the JWT token.
	ValidateClaims struct {
		// Issuer is the issuer of the JWT token.
		Issuer string `json:"-" mapstructure:"issuer" yaml:"issuer,omitempty"`
		// Subject is the subject of the JWT token.
		Subject string `json:"-" mapstructure:"subject" yaml:"subject,omitempty"`
		// Audiences is the audience of the JWT token.
		Audiences []string `json:"-" mapstructure:"audiences" yaml:"audiences,omitempty"`
	} `json:"-" mapstructure:"validate_claims" yaml:"validate_claims,omitempty"`
	// JWKsURL is the URL to the JWKS endpoint.
	// This is used to fetch the public keys used to validate the JWT token.
	JWKSURL string `json:"-" mapstructure:"jwks_url" yaml:"jwks_url,omitempty"`
	// PublicKeyFile is the path to the public PEM encoded key file on disk.
	PublicKeyFile string `json:"-" mapstructure:"public_key_file" yaml:"public_key_file,omitempty"`
}

type AuthenticationMethodKubernetesConfig added in v1.19.0

type AuthenticationMethodKubernetesConfig struct {
	// DiscoveryURL is the URL to the local Kubernetes cluster serving the "well-known" OIDC discovery endpoint.
	// https://openid.net/specs/openid-connect-discovery-1_0.html
	// The URL is used to fetch the OIDC configuration and subsequently the JWKS certificates.
	DiscoveryURL string `json:"discoveryURL,omitempty" mapstructure:"discovery_url" yaml:"discovery_url,omitempty"`
	// CAPath is the path on disk to the trusted certificate authority certificate for validating
	// HTTPS requests to the issuer.
	CAPath string `json:"caPath,omitempty" mapstructure:"ca_path" yaml:"ca_path,omitempty"`
	// ServiceAccountTokenPath is the location on disk to the Flipt instances service account token.
	// This should be the token issued for the service account associated with Flipt in the environment.
	ServiceAccountTokenPath string `` /* 126-byte string literal not displayed */
}

AuthenticationMethodKubernetesConfig contains the fields necessary for the Kubernetes authentication method to be performed. This method supports Flipt being deployed in a Kubernetes environment and allowing it to exchange client tokens for valid service account tokens presented via this method.

type AuthenticationMethodOIDCConfig added in v1.17.0

type AuthenticationMethodOIDCConfig struct {
	EmailMatches []string                                    `json:"emailMatches,omitempty" mapstructure:"email_matches" yaml:"email_matches,omitempty"`
	Providers    map[string]AuthenticationMethodOIDCProvider `json:"providers,omitempty" mapstructure:"providers" yaml:"providers,omitempty"`
}

AuthenticationMethodOIDCConfig configures the OIDC authentication method. This method can be used to establish browser based sessions.

type AuthenticationMethodOIDCProvider added in v1.17.0

type AuthenticationMethodOIDCProvider struct {
	IssuerURL       string   `json:"issuerURL,omitempty" mapstructure:"issuer_url" yaml:"issuer_url,omitempty"`
	ClientID        string   `json:"-,omitempty" mapstructure:"client_id" yaml:"-"`
	ClientSecret    string   `json:"-" mapstructure:"client_secret" yaml:"-"`
	RedirectAddress string   `json:"redirectAddress,omitempty" mapstructure:"redirect_address" yaml:"redirect_address,omitempty"`
	Scopes          []string `json:"scopes,omitempty" mapstructure:"scopes" yaml:"scopes,omitempty"`
	UsePKCE         bool     `json:"usePKCE,omitempty" mapstructure:"use_pkce" yaml:"use_pkce,omitempty"`
}

AuthenticationOIDCProvider configures provider credentials

type AuthenticationMethodTokenBootstrapConfig added in v1.19.0

type AuthenticationMethodTokenBootstrapConfig struct {
	Token      string        `json:"-" mapstructure:"token" yaml:"token"`
	Expiration time.Duration `json:"expiration,omitempty" mapstructure:"expiration" yaml:"expiration,omitempty"`
}

AuthenticationMethodTokenBootstrapConfig contains fields used to configure the bootstrap process for the authentication method "token".

type AuthenticationMethodTokenConfig added in v1.15.0

type AuthenticationMethodTokenConfig struct {
	Bootstrap AuthenticationMethodTokenBootstrapConfig `json:"bootstrap" mapstructure:"bootstrap" yaml:"bootstrap"`
}

AuthenticationMethodTokenConfig contains fields used to configure the authentication method "token". This authentication method supports the ability to create static tokens via the /auth/v1/method/token prefix of endpoints.

type AuthenticationMethods added in v1.16.0

type AuthenticationMethods struct {
	Token      AuthenticationMethod[AuthenticationMethodTokenConfig]      `json:"token,omitempty" mapstructure:"token" yaml:"token,omitempty"`
	Github     AuthenticationMethod[AuthenticationMethodGithubConfig]     `json:"github,omitempty" mapstructure:"github" yaml:"github,omitempty"`
	OIDC       AuthenticationMethod[AuthenticationMethodOIDCConfig]       `json:"oidc,omitempty" mapstructure:"oidc" yaml:"oidc,omitempty"`
	Kubernetes AuthenticationMethod[AuthenticationMethodKubernetesConfig] `json:"kubernetes,omitempty" mapstructure:"kubernetes" yaml:"kubernetes,omitempty"`
	JWT        AuthenticationMethod[AuthenticationMethodJWTConfig]        `json:"jwt,omitempty" mapstructure:"jwt" yaml:"jwt,omitempty"`
	Cloud      AuthenticationMethod[AuthenticationMethodCloudConfig]      `json:"cloud,omitempty" mapstructure:"cloud" yaml:"cloud,omitempty"`
}

AuthenticationMethods is a set of configuration for each authentication method available for use within Flipt.

func (*AuthenticationMethods) AllMethods added in v1.17.0

AllMethods returns all the AuthenticationMethod instances available.

func (*AuthenticationMethods) EnabledMethods added in v1.21.0

EnabledMethods returns all the AuthenticationMethod instances that have been enabled.

type AuthenticationSession added in v1.17.0

type AuthenticationSession struct {
	// Domain is the domain on which to register session cookies.
	Domain string `json:"domain,omitempty" mapstructure:"domain" yaml:"domain,omitempty"`
	// Secure sets the secure property (i.e. HTTPS only) on both the state and token cookies.
	Secure bool `json:"secure,omitempty" mapstructure:"secure" yaml:"secure,omitempty"`
	// TokenLifetime is the duration of the flipt client token generated once
	// authentication has been established via a session compatible method.
	TokenLifetime time.Duration `json:"tokenLifetime,omitempty" mapstructure:"token_lifetime" yaml:"token_lifetime,omitempty"`
	// StateLifetime is the lifetime duration of the state cookie.
	StateLifetime time.Duration `json:"stateLifetime,omitempty" mapstructure:"state_lifetime" yaml:"state_lifetime,omitempty"`
	// CSRF configures CSRF provention mechanisms.
	CSRF AuthenticationSessionCSRF `json:"csrf,omitempty" mapstructure:"csrf" yaml:"csrf,omitempty"`
}

AuthenticationSession configures the session produced for browsers when establishing authentication via HTTP.

type AuthenticationSessionCSRF added in v1.17.0

type AuthenticationSessionCSRF struct {
	// Key is the private key string used to authenticate csrf tokens.
	Key string `json:"-" mapstructure:"key"`
}

AuthenticationSessionCSRF configures cross-site request forgery prevention.

type BasicAuth added in v1.23.0

type BasicAuth struct {
	Username string `json:"-" mapstructure:"username" yaml:"-"`
	Password string `json:"-" mapstructure:"password" yaml:"-"`
}

BasicAuth has configuration for authenticating with private git repositories with basic auth.

type BufferConfig added in v1.21.0

type BufferConfig struct {
	Capacity    int           `json:"capacity,omitempty" mapstructure:"capacity" yaml:"capacity,omitempty"`
	FlushPeriod time.Duration `json:"flushPeriod,omitempty" mapstructure:"flush_period" yaml:"flush_period,omitempty"`
}

BufferConfig holds configuration for the buffering of sending the audit events to the sinks.

type CacheBackend

type CacheBackend uint8

CacheBackend is either memory or redis TODO: can we use a string here instead?

const (

	// CacheMemory ...
	CacheMemory CacheBackend
	// CacheRedis ...
	CacheRedis
)

func (CacheBackend) MarshalJSON

func (c CacheBackend) MarshalJSON() ([]byte, error)

func (CacheBackend) MarshalYAML added in v1.28.0

func (c CacheBackend) MarshalYAML() (interface{}, error)

func (CacheBackend) String

func (c CacheBackend) String() string

type CacheConfig

type CacheConfig struct {
	Enabled bool              `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
	TTL     time.Duration     `json:"ttl,omitempty" mapstructure:"ttl" yaml:"ttl,omitempty"`
	Backend CacheBackend      `json:"backend,omitempty" mapstructure:"backend" yaml:"backend,omitempty"`
	Memory  MemoryCacheConfig `json:"memory,omitempty" mapstructure:"memory" yaml:"memory,omitempty"`
	Redis   RedisCacheConfig  `json:"redis,omitempty" mapstructure:"redis" yaml:"redis,omitempty"`
}

CacheConfig contains fields, which enable and configure Flipt's various caching mechanisms.

Currently, flipt support in-memory and redis backed caching.

func (CacheConfig) IsZero added in v1.28.0

func (c CacheConfig) IsZero() bool

IsZero returns true if the cache config is not enabled. This is used for marshalling to YAML for `config init`.

type ClickhouseConfig added in v1.37.0

type ClickhouseConfig struct {
	Enabled bool   `json:"enabled,omitempty" mapstructure:"enabled" yaml:"enabled,omitempty"`
	URL     string `json:"-" mapstructure:"url" yaml:"url,omitempty"`
}

ClickhouseConfig defines the connection details for connecting Flipt to Clickhouse.

func (*ClickhouseConfig) Options added in v1.37.0

func (c *ClickhouseConfig) Options() (*clickhouse.Options, error)

Options returns the connection option details for Clickhouse.

type CloudAuthenticationConfig added in v1.42.0

type CloudAuthenticationConfig struct {
	ApiKey string `json:"-" mapstructure:"api_key" yaml:"api_key,omitempty"`
}

type CloudConfig added in v1.42.0

type CloudConfig struct {
	Host           string                    `json:"host,omitempty" mapstructure:"host" yaml:"host,omitempty"`
	Authentication CloudAuthenticationConfig `json:"-" mapstructure:"authentication" yaml:"authentication,omitempty"`
	Organization   string                    `json:"organization,omitempty" mapstructure:"organization" yaml:"organization,omitempty"`
	Instance       string                    `json:"instance,omitempty" mapstructure:"instance" yaml:"instance,omitempty"`
}

type CloudServerConfig added in v1.42.0

type CloudServerConfig struct {
	Enabled bool `json:"enabled,omitempty" mapstructure:"enabled" yaml:"enabled"`
	Port    int  `json:"port,omitempty" mapstructure:"port" yaml:"port,omitempty"`
}

type CloudSinkConfig added in v1.42.0

type CloudSinkConfig struct {
	Enabled bool `json:"enabled,omitempty" mapstructure:"enabled" yaml:"enabled,omitempty"`
}

type Config

type Config struct {
	Version        string               `json:"version,omitempty" mapstructure:"version,omitempty" yaml:"version,omitempty"`
	Audit          AuditConfig          `json:"audit,omitempty" mapstructure:"audit" yaml:"audit,omitempty"`
	Authentication AuthenticationConfig `json:"authentication,omitempty" mapstructure:"authentication" yaml:"authentication,omitempty"`
	Cache          CacheConfig          `json:"cache,omitempty" mapstructure:"cache" yaml:"cache,omitempty"`
	Cloud          CloudConfig          `json:"cloud,omitempty" mapstructure:"cloud" yaml:"cloud,omitempty" experiment:"cloud"`
	Cors           CorsConfig           `json:"cors,omitempty" mapstructure:"cors" yaml:"cors,omitempty"`
	Database       DatabaseConfig       `json:"db,omitempty" mapstructure:"db" yaml:"db,omitempty"`
	Diagnostics    DiagnosticConfig     `json:"diagnostics,omitempty" mapstructure:"diagnostics" yaml:"diagnostics,omitempty"`
	Experimental   ExperimentalConfig   `json:"experimental,omitempty" mapstructure:"experimental" yaml:"experimental,omitempty"`
	Log            LogConfig            `json:"log,omitempty" mapstructure:"log" yaml:"log,omitempty"`
	Meta           MetaConfig           `json:"meta,omitempty" mapstructure:"meta" yaml:"meta,omitempty"`
	Analytics      AnalyticsConfig      `json:"analytics,omitempty" mapstructure:"analytics" yaml:"analytics,omitempty"`
	Server         ServerConfig         `json:"server,omitempty" mapstructure:"server" yaml:"server,omitempty"`
	Storage        StorageConfig        `json:"storage,omitempty" mapstructure:"storage" yaml:"storage,omitempty"`
	Metrics        MetricsConfig        `json:"metrics,omitempty" mapstructure:"metrics" yaml:"metrics,omitempty"`
	Tracing        TracingConfig        `json:"tracing,omitempty" mapstructure:"tracing" yaml:"tracing,omitempty"`
	UI             UIConfig             `json:"ui,omitempty" mapstructure:"ui" yaml:"ui,omitempty"`
}

Config contains all of Flipts configuration needs.

The root of this structure contains a collection of sub-configuration categories.

Each sub-configuration (e.g. LogConfig) optionally implements either or both of the defaulter or validator interfaces. Given the sub-config implements a `setDefaults(*viper.Viper) []string` method then this will be called with the viper context before unmarshalling. This allows the sub-configuration to set any appropriate defaults. Given the sub-config implements a `validate() error` method then this will be called after unmarshalling, such that the function can emit any errors derived from the resulting state of the configuration.

func Default

func Default() *Config

Default is the base config used when no configuration is explicit provided.

func (*Config) ServeHTTP

func (c *Config) ServeHTTP(w http.ResponseWriter, r *http.Request)

type CorsConfig

type CorsConfig struct {
	Enabled        bool     `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
	AllowedOrigins []string `json:"allowedOrigins,omitempty" mapstructure:"allowed_origins" yaml:"allowed_origins,omitempty"`
	AllowedHeaders []string `json:"allowedHeaders,omitempty" mapstructure:"allowed_headers" yaml:"allowed_headers,omitempty"`
}

CorsConfig contains fields, which configure behaviour in the HTTPServer relating to the CORS header-based mechanisms.

type DatabaseConfig

type DatabaseConfig struct {
	URL                       string           `json:"url,omitempty" mapstructure:"url,omitempty" yaml:"url,omitempty"`
	MaxIdleConn               int              `json:"maxIdleConn,omitempty" mapstructure:"max_idle_conn" yaml:"max_idle_conn,omitempty"`
	MaxOpenConn               int              `json:"maxOpenConn,omitempty" mapstructure:"max_open_conn" yaml:"max_open_conn,omitempty"`
	ConnMaxLifetime           time.Duration    `json:"connMaxLifetime,omitempty" mapstructure:"conn_max_lifetime" yaml:"conn_max_lifetime,omitempty"`
	Name                      string           `json:"name,omitempty" mapstructure:"name,omitempty" yaml:"name,omitempty"`
	User                      string           `json:"user,omitempty" mapstructure:"user,omitempty" yaml:"user,omitempty"`
	Password                  string           `json:"-" mapstructure:"password,omitempty" yaml:"-"`
	Host                      string           `json:"host,omitempty" mapstructure:"host,omitempty" yaml:"host,omitempty"`
	Port                      int              `json:"port,omitempty" mapstructure:"port,omitempty" yaml:"port,omitempty"`
	Protocol                  DatabaseProtocol `json:"protocol,omitempty" mapstructure:"protocol,omitempty" yaml:"protocol,omitempty"`
	PreparedStatementsEnabled bool             `` /* 130-byte string literal not displayed */
}

DatabaseConfig contains fields, which configure the various relational database backends.

Flipt currently supports SQLite, Postgres and MySQL backends.

type DatabaseProtocol

type DatabaseProtocol uint8

DatabaseProtocol represents a database protocol

const (

	// DatabaseSQLite ...
	DatabaseSQLite DatabaseProtocol
	// DatabasePostgres ...
	DatabasePostgres
	// DatabaseMySQL ...
	DatabaseMySQL
	// DatabaseCockroachDB ...
	DatabaseCockroachDB
	// DatabaseLibSQL ...
	DatabaseLibSQL
)

func (DatabaseProtocol) MarshalJSON

func (d DatabaseProtocol) MarshalJSON() ([]byte, error)

func (DatabaseProtocol) String

func (d DatabaseProtocol) String() string

type DiagnosticConfig added in v1.29.0

type DiagnosticConfig struct {
	Profiling ProfilingDiagnosticConfig `json:"profiling,omitempty" mapstructure:"profiling" yaml:"profiling,omitempty"`
}

type ExperimentalConfig added in v1.23.0

type ExperimentalConfig struct {
	Cloud ExperimentalFlag `json:"cloud,omitempty" mapstructure:"cloud" yaml:"cloud,omitempty"`
}

ExperimentalConfig allows for experimental features to be enabled and disabled.

type ExperimentalFlag added in v1.23.0

type ExperimentalFlag struct {
	Enabled bool `json:"enabled,omitempty" mapstructure:"enabled" yaml:"enabled,omitempty"`
}

ExperimentalFlag is a structure which has properties to configure experimental feature enablement.

type GS added in v1.35.0

type GS struct {
	Bucket       string        `json:"-" mapstructure:"bucket" yaml:"bucket,omitempty"`
	Prefix       string        `json:"prefix,omitempty" mapstructure:"prefix" yaml:"prefix,omitempty"`
	PollInterval time.Duration `json:"pollInterval,omitempty" mapstructure:"poll_interval" yaml:"poll_interval,omitempty"`
}

GS contains configuration for referencing a Google Cloud Storage

type Git added in v1.23.0

type Git struct {
	Repository      string         `json:"repository,omitempty" mapstructure:"repository" yaml:"repository,omitempty"`
	Ref             string         `json:"ref,omitempty" mapstructure:"ref" yaml:"ref,omitempty"`
	RefType         GitRefType     `json:"refType,omitempty" mapstructure:"ref_type" yaml:"ref_type,omitempty"`
	Directory       string         `json:"directory,omitempty" mapstructure:"directory" yaml:"directory,omitempty"`
	CaCertBytes     string         `json:"-" mapstructure:"ca_cert_bytes" yaml:"-" `
	CaCertPath      string         `json:"-" mapstructure:"ca_cert_path" yaml:"-" `
	InsecureSkipTLS bool           `json:"-" mapstructure:"insecure_skip_tls" yaml:"-"`
	PollInterval    time.Duration  `json:"pollInterval,omitempty" mapstructure:"poll_interval" yaml:"poll_interval,omitempty"`
	Authentication  Authentication `json:"-" mapstructure:"authentication,omitempty" yaml:"-"`
}

Git contains configuration for referencing a git repository.

type GitRefType added in v1.41.0

type GitRefType string

GitRefType describes the resolve types for git storages.

const (
	GitRefTypeStatic GitRefType = "static"
	GitRefTypeSemver GitRefType = "semver"
)

type JaegerTracingConfig

type JaegerTracingConfig struct {
	Host string `json:"host,omitempty" mapstructure:"host" yaml:"host,omitempty"`
	Port int    `json:"port,omitempty" mapstructure:"port" yaml:"port,omitempty"`
}

JaegerTracingConfig contains fields, which configure Jaeger span and tracing output destination.

type Local added in v1.23.0

type Local struct {
	Path string `json:"path,omitempty" mapstructure:"path"`
}

Local contains configuration for referencing a local filesystem.

type LogConfig

type LogConfig struct {
	Level     string      `json:"level,omitempty" mapstructure:"level" yaml:"level,omitempty"`
	File      string      `json:"file,omitempty" mapstructure:"file" yaml:"file,omitempty"`
	Encoding  LogEncoding `json:"encoding,omitempty" mapstructure:"encoding" yaml:"encoding,omitempty"`
	GRPCLevel string      `json:"grpcLevel,omitempty" mapstructure:"grpc_level" yaml:"grpc_level,omitempty"`
	Keys      LogKeys     `json:"keys,omitempty" mapstructure:"keys" yaml:"-"`
}

LogConfig contains fields which control, direct and filter the logging telemetry produces by Flipt.

type LogEncoding

type LogEncoding uint8

LogEncoding is either console or JSON. TODO: can we use a string instead?

const (
	LogEncodingConsole LogEncoding
	LogEncodingJSON
)

func (LogEncoding) MarshalJSON

func (e LogEncoding) MarshalJSON() ([]byte, error)

func (LogEncoding) MarshalYAML added in v1.28.0

func (e LogEncoding) MarshalYAML() (interface{}, error)

func (LogEncoding) String

func (e LogEncoding) String() string

type LogFileSinkConfig added in v1.21.0

type LogFileSinkConfig struct {
	Enabled bool   `json:"enabled,omitempty" mapstructure:"enabled" yaml:"enabled,omitempty"`
	File    string `json:"file,omitempty" mapstructure:"file" yaml:"file,omitempty"`
}

LogFileSinkConfig contains fields that hold configuration for sending audits to a log file.

type LogKeys added in v1.18.1

type LogKeys struct {
	Time    string `json:"time,omitempty" mapstructure:"time" yaml:"time,omitempty"`
	Level   string `json:"level,omitempty" mapstructure:"level" yaml:"level,omitempty"`
	Message string `json:"message,omitempty" mapstructure:"message" yaml:"message,omitempty"`
}

type MemoryCacheConfig

type MemoryCacheConfig struct {
	EvictionInterval time.Duration `json:"evictionInterval,omitempty" mapstructure:"eviction_interval" yaml:"eviction_interval,omitempty"`
}

MemoryCacheConfig contains fields, which configure in-memory caching.

type MetaConfig

type MetaConfig struct {
	CheckForUpdates  bool   `json:"checkForUpdates" mapstructure:"check_for_updates" yaml:"check_for_updates"`
	TelemetryEnabled bool   `json:"telemetryEnabled" mapstructure:"telemetry_enabled" yaml:"telemetry_enabled"`
	StateDirectory   string `json:"stateDirectory,omitempty" mapstructure:"state_directory" yaml:"state_directory,omitempty"`
}

MetaConfig contains a variety of meta configuration fields.

type MetricsConfig added in v1.41.0

type MetricsConfig struct {
	Enabled  bool              `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
	Exporter MetricsExporter   `json:"exporter,omitempty" mapstructure:"exporter" yaml:"exporter,omitempty"`
	OTLP     OTLPMetricsConfig `json:"otlp,omitempty" mapstructure:"otlp,omitempty" yaml:"otlp,omitempty"`
}

type MetricsExporter added in v1.41.0

type MetricsExporter string
const (
	MetricsPrometheus MetricsExporter = "prometheus"
	MetricsOTLP       MetricsExporter = "otlp"
)

type OCI added in v1.31.0

type OCI struct {
	// Repository is the target repository and reference to track.
	// It should be in the form [<registry>/]<bundle>[:<tag>].
	// When the registry is omitted, the bundle is referenced via the local bundle store.
	// Tag defaults to 'latest' when not supplied.
	Repository string `json:"repository,omitempty" mapstructure:"repository" yaml:"repository,omitempty"`
	// BundlesDirectory is the root directory in which Flipt will store and access local feature bundles.
	BundlesDirectory string `json:"bundlesDirectory,omitempty" mapstructure:"bundles_directory" yaml:"bundles_directory,omitempty"`
	// Authentication configures authentication credentials for accessing the target registry
	Authentication *OCIAuthentication `json:"-,omitempty" mapstructure:"authentication" yaml:"-,omitempty"`
	PollInterval   time.Duration      `json:"pollInterval,omitempty" mapstructure:"poll_interval" yaml:"poll_interval,omitempty"`
	// ManifestVersion defines which OCI Manifest version to use.
	ManifestVersion OCIManifestVersion `json:"manifestVersion,omitempty" mapstructure:"manifest_version" yaml:"manifest_version,omitempty"`
}

OCI provides configuration support for OCI target registries as a backend store for Flipt.

type OCIAuthentication added in v1.31.0

type OCIAuthentication struct {
	Type     oci.AuthenticationType `json:"-" mapstructure:"type" yaml:"-"`
	Username string                 `json:"-" mapstructure:"username" yaml:"-"`
	Password string                 `json:"-" mapstructure:"password" yaml:"-"`
}

OCIAuthentication configures the credentials for authenticating against a target OCI regitstry

type OCIManifestVersion added in v1.39.1

type OCIManifestVersion string
const (
	OCIManifestVersion10 OCIManifestVersion = "1.0"
	OCIManifestVersion11 OCIManifestVersion = "1.1"
)

type OTLPMetricsConfig added in v1.41.0

type OTLPMetricsConfig struct {
	Endpoint string            `json:"endpoint,omitempty" mapstructure:"endpoint" yaml:"endpoint,omitempty"`
	Headers  map[string]string `json:"headers,omitempty" mapstructure:"headers" yaml:"headers,omitempty"`
}

type OTLPTracingConfig added in v1.18.2

type OTLPTracingConfig struct {
	Endpoint string            `json:"endpoint,omitempty" mapstructure:"endpoint" yaml:"endpoint,omitempty"`
	Headers  map[string]string `json:"headers,omitempty" mapstructure:"headers" yaml:"headers,omitempty"`
}

OTLPTracingConfig contains fields, which configure OTLP span and tracing output destination.

type Object added in v1.24.0

type Object struct {
	Type   ObjectSubStorageType `json:"type,omitempty" mapstructure:"type" yaml:"type,omitempty"`
	S3     *S3                  `json:"s3,omitempty" mapstructure:"s3,omitempty" yaml:"s3,omitempty"`
	AZBlob *AZBlob              `json:"azblob,omitempty" mapstructure:"azblob,omitempty" yaml:"azblob,omitempty"`
	GS     *GS                  `json:"googlecloud,omitempty" mapstructure:"googlecloud,omitempty" yaml:"googlecloud,omitempty"`
}

Object contains configuration of readonly object storage.

type ObjectSubStorageType added in v1.24.0

type ObjectSubStorageType string

type ProfilingDiagnosticConfig added in v1.29.0

type ProfilingDiagnosticConfig struct {
	Enabled bool `json:"enabled,omitempty" mapstructure:"enabled" yaml:"enabled,omitempty"`
}

type RedisCacheConfig

type RedisCacheConfig struct {
	Host            string        `json:"host,omitempty" mapstructure:"host" yaml:"host,omitempty"`
	Port            int           `json:"port,omitempty" mapstructure:"port" yaml:"port,omitempty"`
	RequireTLS      bool          `json:"requireTLS,omitempty" mapstructure:"require_tls" yaml:"require_tls,omitempty"`
	Username        string        `json:"-" mapstructure:"username" yaml:"-"`
	Password        string        `json:"-" mapstructure:"password" yaml:"-"`
	DB              int           `json:"db,omitempty" mapstructure:"db" yaml:"db,omitempty"`
	PoolSize        int           `json:"poolSize" mapstructure:"pool_size" yaml:"pool_size"`
	MinIdleConn     int           `json:"minIdleConn" mapstructure:"min_idle_conn" yaml:"min_idle_conn"`
	ConnMaxIdleTime time.Duration `json:"connMaxIdleTime" mapstructure:"conn_max_idle_time" yaml:"conn_max_idle_time"`
	NetTimeout      time.Duration `json:"netTimeout" mapstructure:"net_timeout" yaml:"net_timeout"`
}

RedisCacheConfig contains fields, which configure the connection credentials for redis backed caching.

type Result added in v1.17.0

type Result struct {
	Config   *Config
	Warnings []string
}

func Load

func Load(ctx context.Context, path string) (*Result, error)

type S3 added in v1.24.0

type S3 struct {
	Endpoint     string        `json:"endpoint,omitempty" mapstructure:"endpoint" yaml:"endpoint,omitempty"`
	Bucket       string        `json:"bucket,omitempty" mapstructure:"bucket" yaml:"bucket,omitempty"`
	Prefix       string        `json:"prefix,omitempty" mapstructure:"prefix" yaml:"prefix,omitempty"`
	Region       string        `json:"region,omitempty" mapstructure:"region" yaml:"region,omitempty"`
	PollInterval time.Duration `json:"pollInterval,omitempty" mapstructure:"poll_interval" yaml:"poll_interval,omitempty"`
}

S3 contains configuration for referencing a s3 bucket

type SSHAuth added in v1.30.0

type SSHAuth struct {
	User                  string `json:"-" mapstructure:"user" yaml:"-" `
	Password              string `json:"-" mapstructure:"password" yaml:"-" `
	PrivateKeyBytes       string `json:"-" mapstructure:"private_key_bytes" yaml:"-" `
	PrivateKeyPath        string `json:"-" mapstructure:"private_key_path" yaml:"-" `
	InsecureIgnoreHostKey bool   `json:"-" mapstructure:"insecure_ignore_host_key" yaml:"-"`
}

SSHAuth provides configuration support for SSH private key credentials when authenticating with private git repositories

type Scheme

type Scheme uint

Scheme is either HTTP or HTTPS. TODO: can we use a string instead?

const (
	HTTP Scheme = iota
	HTTPS
)

func (Scheme) MarshalJSON

func (s Scheme) MarshalJSON() ([]byte, error)

func (Scheme) MarshalYAML added in v1.28.0

func (s Scheme) MarshalYAML() (interface{}, error)

func (Scheme) String

func (s Scheme) String() string

type ServerConfig

type ServerConfig struct {
	Host                      string            `json:"host,omitempty" mapstructure:"host" yaml:"host,omitempty"`
	Protocol                  Scheme            `json:"protocol,omitempty" mapstructure:"protocol" yaml:"protocol,omitempty"`
	HTTPPort                  int               `json:"httpPort,omitempty" mapstructure:"http_port" yaml:"http_port,omitempty"`
	HTTPSPort                 int               `json:"httpsPort,omitempty" mapstructure:"https_port" yaml:"https_port,omitempty"`
	GRPCPort                  int               `json:"grpcPort,omitempty" mapstructure:"grpc_port" yaml:"grpc_port,omitempty"`
	CertFile                  string            `json:"-" mapstructure:"cert_file" yaml:"-"`
	CertKey                   string            `json:"-" mapstructure:"cert_key" yaml:"-"`
	GRPCConnectionMaxIdleTime time.Duration     `json:"-" mapstructure:"grpc_conn_max_idle_time" yaml:"-"`
	GRPCConnectionMaxAge      time.Duration     `json:"-" mapstructure:"grpc_conn_max_age" yaml:"-"`
	GRPCConnectionMaxAgeGrace time.Duration     `json:"-" mapstructure:"grpc_conn_max_age_grace" yaml:"-"`
	Cloud                     CloudServerConfig `json:"cloud,omitempty" mapstructure:"cloud" yaml:"cloud,omitempty"`
}

ServerConfig contains fields, which configure both HTTP and gRPC API serving.

type SinksConfig added in v1.21.0

type SinksConfig struct {
	LogFile LogFileSinkConfig `json:"log,omitempty" mapstructure:"log" yaml:"log,omitempty"`
	Webhook WebhookSinkConfig `json:"webhook,omitempty" mapstructure:"webhook" yaml:"webhook,omitempty"`
	Cloud   CloudSinkConfig   `json:"cloud,omitempty" mapstructure:"cloud" yaml:"cloud,omitempty"`
}

SinksConfig contains configuration held in structures for the different sinks that we will send audits to.

type StaticAuthenticationMethodInfo added in v1.17.0

type StaticAuthenticationMethodInfo struct {
	AuthenticationMethodInfo
	Enabled bool
	Cleanup *AuthenticationCleanupSchedule
	// contains filtered or unexported fields
}

StaticAuthenticationMethodInfo embeds an AuthenticationMethodInfo alongside the other properties of an AuthenticationMethod.

func (StaticAuthenticationMethodInfo) Enable added in v1.18.2

Enable can only be called in a testing scenario. It is used to enable a target method without having a concrete reference.

func (StaticAuthenticationMethodInfo) RequiresCleanup added in v1.42.0

func (s StaticAuthenticationMethodInfo) RequiresCleanup() bool

RequiresCleanup returns true if the method is enabled and requires cleanup.

func (StaticAuthenticationMethodInfo) SetCleanup added in v1.18.2

SetCleanup can only be called in a testing scenario. It is used to configure cleanup for a target method without having a concrete reference.

type StorageConfig added in v1.23.0

type StorageConfig struct {
	Type     StorageType `json:"type,omitempty" mapstructure:"type" yaml:"type,omitempty"`
	Local    *Local      `json:"local,omitempty" mapstructure:"local,omitempty" yaml:"local,omitempty"`
	Git      *Git        `json:"git,omitempty" mapstructure:"git,omitempty" yaml:"git,omitempty"`
	Object   *Object     `json:"object,omitempty" mapstructure:"object,omitempty" yaml:"object,omitempty"`
	OCI      *OCI        `json:"oci,omitempty" mapstructure:"oci,omitempty" yaml:"oci,omitempty"`
	ReadOnly *bool       `json:"readOnly,omitempty" mapstructure:"read_only,omitempty" yaml:"read_only,omitempty"`
}

StorageConfig contains fields which will configure the type of backend in which Flipt will serve flag state.

type StorageType added in v1.23.0

type StorageType string

type TokenAuth added in v1.23.0

type TokenAuth struct {
	AccessToken string `json:"-" mapstructure:"access_token" yaml:"-"`
}

TokenAuth has configuration for authenticating with private git repositories with token auth.

type TracingConfig

type TracingConfig struct {
	Enabled       bool                `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
	Exporter      TracingExporter     `json:"exporter,omitempty" mapstructure:"exporter" yaml:"exporter,omitempty"`
	Propagators   []TracingPropagator `json:"propagators,omitempty" mapstructure:"propagators" yaml:"propagators,omitempty"`
	SamplingRatio float64             `json:"samplingRatio,omitempty" mapstructure:"sampling_ratio" yaml:"sampling_ratio,omitempty"`
	Jaeger        JaegerTracingConfig `json:"jaeger,omitempty" mapstructure:"jaeger" yaml:"jaeger,omitempty"`
	Zipkin        ZipkinTracingConfig `json:"zipkin,omitempty" mapstructure:"zipkin" yaml:"zipkin,omitempty"`
	OTLP          OTLPTracingConfig   `json:"otlp,omitempty" mapstructure:"otlp" yaml:"otlp,omitempty"`
}

TracingConfig contains fields, which configure tracing telemetry output destinations.

func (TracingConfig) IsZero added in v1.28.0

func (c TracingConfig) IsZero() bool

IsZero returns true if the tracing config is not enabled. This is used for marshalling to YAML for `config init`.

type TracingExporter added in v1.18.2

type TracingExporter uint8

TracingExporter represents the supported tracing exporters. TODO: can we use a string here instead?

const (

	// TracingJaeger ...
	TracingJaeger TracingExporter
	// TracingZipkin ...
	TracingZipkin
	// TracingOTLP ...
	TracingOTLP
)

func (TracingExporter) MarshalJSON added in v1.18.2

func (e TracingExporter) MarshalJSON() ([]byte, error)

func (TracingExporter) MarshalYAML added in v1.28.0

func (e TracingExporter) MarshalYAML() (interface{}, error)

func (TracingExporter) String added in v1.18.2

func (e TracingExporter) String() string

type TracingPropagator added in v1.41.0

type TracingPropagator string
const (
	TracingPropagatorTraceContext TracingPropagator = "tracecontext"
	TracingPropagatorBaggage      TracingPropagator = "baggage"
	TracingPropagatorB3           TracingPropagator = "b3"
	TracingPropagatorB3Multi      TracingPropagator = "b3multi"
	TracingPropagatorJaeger       TracingPropagator = "jaeger"
	TracingPropagatorXRay         TracingPropagator = "xray"
	TracingPropagatorOtTrace      TracingPropagator = "ottrace"
	TracingPropagatorNone         TracingPropagator = "none"
)

type UIConfig

type UIConfig struct {
	DefaultTheme UITheme `json:"defaultTheme" mapstructure:"default_theme" yaml:"default_theme"`
}

UIConfig contains fields, which control the behaviour of Flipt's user interface.

type UITheme added in v1.27.0

type UITheme string

type WebhookSinkConfig added in v1.27.0

type WebhookSinkConfig struct {
	Enabled            bool              `json:"enabled" mapstructure:"enabled" yaml:"enabled"`
	URL                string            `json:"url,omitempty" mapstructure:"url" yaml:"url,omitempty"`
	MaxBackoffDuration time.Duration     `json:"maxBackoffDuration,omitempty" mapstructure:"max_backoff_duration" yaml:"max_backoff_duration,omitempty"`
	SigningSecret      string            `json:"-" mapstructure:"signing_secret" yaml:"-"`
	Templates          []WebhookTemplate `json:"templates,omitempty" mapstructure:"templates" yaml:"templates,omitempty"`
}

WebhookSinkConfig contains configuration for sending POST requests to specific URL as its configured.

type WebhookTemplate added in v1.28.0

type WebhookTemplate struct {
	URL     string            `json:"url,omitempty" mapstructure:"url"`
	Body    string            `json:"body,omitempty" mapstructure:"body"`
	Headers map[string]string `json:"headers,omitempty" mapstructure:"headers"`
}

WebhookTemplate specifies configuration for a user to send a payload a particular destination URL.

type ZipkinTracingConfig added in v1.18.2

type ZipkinTracingConfig struct {
	Endpoint string `json:"endpoint,omitempty" mapstructure:"endpoint" yaml:"endpoint,omitempty"`
}

ZipkinTracingConfig contains fields, which configure Zipkin span and tracing output destination.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL