config

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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,omitempty" mapstructure:"required"`

	Methods struct {
		Token AuthenticationMethodTokenConfig `json:"token,omitempty" mapstructure:"token"`
	} `json:"methods,omitempty" mapstructure:"methods"`
}

AuthenticationConfig configures Flipts authentication mechanisms

type AuthenticationMethodTokenConfig added in v1.15.0

type AuthenticationMethodTokenConfig struct {
	// Enabled designates whether or not static token authentication is enabled
	// and whether Flipt will mount the "token" method APIs.
	Enabled bool `json:"enabled,omitempty" mapstructure:"enabled"`
}

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 CacheBackend

type CacheBackend uint8

CacheBackend is either memory or redis

const (

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

func (CacheBackend) MarshalJSON

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

func (CacheBackend) String

func (c CacheBackend) String() string

type CacheConfig

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

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

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

type Config

type Config struct {
	Log            LogConfig            `json:"log,omitempty" mapstructure:"log"`
	UI             UIConfig             `json:"ui,omitempty" mapstructure:"ui"`
	Cors           CorsConfig           `json:"cors,omitempty" mapstructure:"cors"`
	Cache          CacheConfig          `json:"cache,omitempty" mapstructure:"cache"`
	Server         ServerConfig         `json:"server,omitempty" mapstructure:"server"`
	Tracing        TracingConfig        `json:"tracing,omitempty" mapstructure:"tracing"`
	Database       DatabaseConfig       `json:"database,omitempty" mapstructure:"db"`
	Meta           MetaConfig           `json:"meta,omitempty" mapstructure:"meta"`
	Authentication AuthenticationConfig `json:"authentication,omitempty" mapstructure:"authentication"`
	Warnings       []string             `json:"warnings,omitempty"`
}

Config contains all of Flipts configuration needs.

The root of this structure contains a collection of sub-configuration categories, along with a set of warnings derived once the configuration has been loaded.

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 Load

func Load(path string) (*Config, error)

func (*Config) ServeHTTP

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

type CorsConfig

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

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"`
	MaxIdleConn     int              `json:"maxIdleConn,omitempty" mapstructure:"max_idle_conn"`
	MaxOpenConn     int              `json:"maxOpenConn,omitempty" mapstructure:"max_open_conn"`
	ConnMaxLifetime time.Duration    `json:"connMaxLifetime,omitempty" mapstructure:"conn_max_lifetime"`
	Name            string           `json:"name,omitempty" mapstructure:"name"`
	User            string           `json:"user,omitempty" mapstructure:"user"`
	Password        string           `json:"password,omitempty" mapstructure:"password"`
	Host            string           `json:"host,omitempty" mapstructure:"host"`
	Port            int              `json:"port,omitempty" mapstructure:"port"`
	Protocol        DatabaseProtocol `json:"protocol,omitempty" mapstructure:"protocol"`
}

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
)

func (DatabaseProtocol) MarshalJSON

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

func (DatabaseProtocol) String

func (d DatabaseProtocol) String() string

type JaegerTracingConfig

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

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

type LogConfig

type LogConfig struct {
	Level     string      `json:"level,omitempty" mapstructure:"level"`
	File      string      `json:"file,omitempty" mapstructure:"file"`
	Encoding  LogEncoding `json:"encoding,omitempty" mapstructure:"encoding"`
	GRPCLevel string      `json:"grpc_level,omitempty" mapstructure:"grpc_level"`
}

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

const (
	LogEncodingConsole LogEncoding
	LogEncodingJSON
)

func (LogEncoding) MarshalJSON

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

func (LogEncoding) String

func (e LogEncoding) String() string

type MemoryCacheConfig

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

MemoryCacheConfig contains fields, which configure in-memory caching.

type MetaConfig

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

MetaConfig contains a variety of meta configuration fields.

type RedisCacheConfig

type RedisCacheConfig struct {
	Host     string `json:"host,omitempty" mapstructure:"host"`
	Port     int    `json:"port,omitempty" mapstructure:"port"`
	Password string `json:"password,omitempty" mapstructure:"password"`
	DB       int    `json:"db,omitempty" mapstructure:"db"`
}

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

type Scheme

type Scheme uint
const (
	HTTP Scheme = iota
	HTTPS
)

func (Scheme) MarshalJSON

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

func (Scheme) String

func (s Scheme) String() string

type ServerConfig

type ServerConfig struct {
	Host      string `json:"host,omitempty" mapstructure:"host"`
	Protocol  Scheme `json:"protocol,omitempty" mapstructure:"protocol"`
	HTTPPort  int    `json:"httpPort,omitempty" mapstructure:"http_port"`
	HTTPSPort int    `json:"httpsPort,omitempty" mapstructure:"https_port"`
	GRPCPort  int    `json:"grpcPort,omitempty" mapstructure:"grpc_port"`
	CertFile  string `json:"certFile,omitempty" mapstructure:"cert_file"`
	CertKey   string `json:"certKey,omitempty" mapstructure:"cert_key"`
}

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

type TracingConfig

type TracingConfig struct {
	Jaeger JaegerTracingConfig `json:"jaeger,omitempty" mapstructure:"jaeger"`
}

TracingConfig contains fields, which configure tracing telemetry output destinations.

type UIConfig

type UIConfig struct {
	Enabled bool `json:"enabled" mapstructure:"enabled"`
}

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

Jump to

Keyboard shortcuts

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