config

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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"`
	TTL     time.Duration     `json:"ttl,omitempty"`
	Backend CacheBackend      `json:"backend,omitempty"`
	Memory  MemoryCacheConfig `json:"memory,omitempty"`
	Redis   RedisCacheConfig  `json:"redis,omitempty"`
}

type Config

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

func Default

func Default() *Config

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"`
	AllowedOrigins []string `json:"allowedOrigins,omitempty"`
}

type DatabaseConfig

type DatabaseConfig struct {
	MigrationsPath  string           `json:"migrationsPath,omitempty"`
	URL             string           `json:"url,omitempty"`
	MaxIdleConn     int              `json:"maxIdleConn,omitempty"`
	MaxOpenConn     int              `json:"maxOpenConn,omitempty"`
	ConnMaxLifetime time.Duration    `json:"connMaxLifetime,omitempty"`
	Name            string           `json:"name,omitempty"`
	User            string           `json:"user,omitempty"`
	Password        string           `json:"password,omitempty"`
	Host            string           `json:"host,omitempty"`
	Port            int              `json:"port,omitempty"`
	Protocol        DatabaseProtocol `json:"protocol,omitempty"`
}

type DatabaseProtocol

type DatabaseProtocol uint8

DatabaseProtocol represents a database protocol

const (

	// DatabaseSQLite ...
	DatabaseSQLite DatabaseProtocol
	// DatabasePostgres ...
	DatabasePostgres
	// DatabaseMySQL ...
	DatabaseMySQL
)

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"`
	Host    string `json:"host,omitempty"`
	Port    int    `json:"port,omitempty"`
}

type LogConfig

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

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"`
}

type MetaConfig

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

type RedisCacheConfig

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

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"`
	Protocol  Scheme `json:"protocol,omitempty"`
	HTTPPort  int    `json:"httpPort,omitempty"`
	HTTPSPort int    `json:"httpsPort,omitempty"`
	GRPCPort  int    `json:"grpcPort,omitempty"`
	CertFile  string `json:"certFile,omitempty"`
	CertKey   string `json:"certKey,omitempty"`
}

type TracingConfig

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

type UIConfig

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

Jump to

Keyboard shortcuts

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