config

package
v0.0.0-...-02374a7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aerospike

type Aerospike struct {
	DefaultTTLSecs  int      `mapstructure:"default_ttl_seconds"`
	Host            string   `mapstructure:"host"`
	Hosts           []string `mapstructure:"hosts"`
	Port            int      `mapstructure:"port"`
	Namespace       string   `mapstructure:"namespace"`
	User            string   `mapstructure:"user"`
	Password        string   `mapstructure:"password"`
	MaxReadRetries  int      `mapstructure:"max_read_retries"`
	MaxWriteRetries int      `mapstructure:"max_write_retries"`
	// Please set this to a value lower than the `proto-fd-idle-ms` (converted
	// to seconds) value set in your Aerospike Server. This is to avoid having
	// race conditions where the server closes the connection but the client still
	// tries to use it. If set to a value less than or equal to 0, Aerospike
	// Client's default value will be used which is 55 seconds.
	ConnIdleTimeoutSecs int `mapstructure:"connection_idle_timeout_seconds"`
	// Specifies the size of the connection queue per node.
	ConnQueueSize int `mapstructure:"connection_queue_size"`
}

type Backend

type Backend struct {
	Type      BackendType `mapstructure:"type"`
	Aerospike Aerospike   `mapstructure:"aerospike"`
	Cassandra Cassandra   `mapstructure:"cassandra"`
	Memcache  Memcache    `mapstructure:"memcache"`
	Redis     Redis       `mapstructure:"redis"`
}

type BackendType

type BackendType string
const (
	BackendAerospike BackendType = "aerospike"
	BackendCassandra BackendType = "cassandra"
	BackendMemcache  BackendType = "memcache"
	BackendMemory    BackendType = "memory"
	BackendRedis     BackendType = "redis"
)

type Cassandra

type Cassandra struct {
	Hosts      string `mapstructure:"hosts"`
	Keyspace   string `mapstructure:"keyspace"`
	DefaultTTL int    `mapstructure:"default_ttl_seconds"`
}

type Compression

type Compression struct {
	Type CompressionType `mapstructure:"type"`
}

type CompressionType

type CompressionType string
const (
	CompressionNone   CompressionType = "none"
	CompressionSnappy CompressionType = "snappy"
)

type Configuration

type Configuration struct {
	Port           int               `mapstructure:"port"`
	AdminPort      int               `mapstructure:"admin_port"`
	IndexResponse  string            `mapstructure:"index_response"`
	Log            Log               `mapstructure:"log"`
	RateLimiting   RateLimiting      `mapstructure:"rate_limiter"`
	RequestLimits  RequestLimits     `mapstructure:"request_limits"`
	StatusResponse string            `mapstructure:"status_response"`
	Backend        Backend           `mapstructure:"backend"`
	Compression    Compression       `mapstructure:"compression"`
	Metrics        Metrics           `mapstructure:"metrics"`
	Routes         Routes            `mapstructure:"routes"`
	Stats          stats.StatsConfig `mapstructure:"stats"`
	Server         Server            `mapstructure:"server"`
	OWLog          OWLog             `mapstructure:"ow_log"`
}

func NewConfig

func NewConfig(filename string) Configuration

func (*Configuration) ValidateAndLog

func (cfg *Configuration) ValidateAndLog()

ValidateAndLog validates the config, terminating the program on any errors. It also logs the config values that it used.

type InfluxMetrics

type InfluxMetrics struct {
	Enabled         bool   `mapstructure:"enabled"`
	Host            string `mapstructure:"host"`
	Database        string `mapstructure:"database"`
	Measurement     string `mapstructure:"measurement"`
	Username        string `mapstructure:"username"`
	Password        string `mapstructure:"password"`
	AlignTimestamps bool   `mapstructure:"align_timestamps"`
}

type Log

type Log struct {
	Level LogLevel `mapstructure:"level"`
}

type LogLevel

type LogLevel string
const (
	Trace   LogLevel = "trace"
	Debug   LogLevel = "debug"
	Info    LogLevel = "info"
	Warning LogLevel = "warning"
	Error   LogLevel = "error"
	Fatal   LogLevel = "fatal"
	Panic   LogLevel = "panic"
)

type Memcache

type Memcache struct {
	ConfigHost          string   `mapstructure:"config_host"`
	PollIntervalSeconds int      `mapstructure:"poll_interval_seconds"`
	Hosts               []string `mapstructure:"hosts"`
}

type Metrics

type Metrics struct {
	Type       MetricsType       `mapstructure:"type"`
	Influx     InfluxMetrics     `mapstructure:"influx"`
	Prometheus PrometheusMetrics `mapstructure:"prometheus"`
}

type MetricsType

type MetricsType string
const (
	MetricsNone   MetricsType = "none"
	MetricsInflux MetricsType = "influx"
)

type OWLog

type OWLog struct {
	LogLevel        logger.LogLevel `mapstructure:"level"`
	LogPath         string          `mapstructure:"path"`
	LogRotationTime time.Duration   `mapstructure:"rotation_time"`
	MaxLogFiles     int             `mapstructure:"max_log_files"`
	MaxLogSize      uint64          `mapstructure:"max_log_size"`
}

type PrometheusMetrics

type PrometheusMetrics struct {
	Port             int    `mapstructure:"port"`
	Namespace        string `mapstructure:"namespace"`
	Subsystem        string `mapstructure:"subsystem"`
	TimeoutMillisRaw int    `mapstructure:"timeout_ms"`
	Enabled          bool   `mapstructure:"enabled"`
}

func (*PrometheusMetrics) Timeout

func (promMetricsConfig *PrometheusMetrics) Timeout() time.Duration

type RateLimiting

type RateLimiting struct {
	Enabled              bool  `mapstructure:"enabled"`
	MaxRequestsPerSecond int64 `mapstructure:"num_requests"`
}

type Redis

type Redis struct {
	Host              string   `mapstructure:"host"`
	Port              int      `mapstructure:"port"`
	Password          string   `mapstructure:"password"`
	Db                int      `mapstructure:"db"`
	ExpirationMinutes int      `mapstructure:"expiration"`
	TLS               RedisTLS `mapstructure:"tls"`
}

type RedisTLS

type RedisTLS struct {
	Enabled            bool `mapstructure:"enabled"`
	InsecureSkipVerify bool `mapstructure:"insecure_skip_verify"`
}

type RequestLimits

type RequestLimits struct {
	MaxSize          int  `mapstructure:"max_size_bytes"`
	MaxNumValues     int  `mapstructure:"max_num_values"`
	MaxTTLSeconds    int  `mapstructure:"max_ttl_seconds"`
	AllowSettingKeys bool `mapstructure:"allow_setting_keys"`
}

type Routes

type Routes struct {
	AllowPublicWrite bool `mapstructure:"allow_public_write"`
}

type Server

type Server struct {
	ServerPort string `mapstructure:"port"`
	ServerName string `mapstructure:"name"`
}

Jump to

Keyboard shortcuts

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