configs

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package configs provides config parameters for Valkyrie components.

Including parsing files, reading environment variables and documentation with examples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncLogConfig

type AsyncLogConfig struct {
	Enabled      bool          `yaml:"enabled" default:"true"`
	BufferSize   int           `yaml:"buffer_size" default:"100000"`
	PollInterval time.Duration `yaml:"poll_interval" default:"10ms"`
}

AsyncLogConfig Configuration for asynchronous logging

type HTTPClientConfig

type HTTPClientConfig struct {
	ReadTimeout    time.Duration `yaml:"read_timeout" default:"10s"`    // Maximum duration for full response reading (including body)
	WriteTimeout   time.Duration `yaml:"write_timeout" default:"3s"`    // Maximum duration for full request writing (including body)
	RequestTimeout time.Duration `yaml:"request_timeout" default:"10s"` // Maximum duration to wait for the request response (on timeout request will continue in background, try setting read/write timeout to interrupt actual request)
	IdleTimeout    time.Duration `yaml:"idle_timeout" default:"30s"`    // Idle keep-alive connections are closed after this duration.
}

HTTPClientConfig Configuration for outgoing requests

type HTTPServerConfig

type HTTPServerConfig struct {
	// ProviderAddress configures host and port where Valkyrie will attempt to listen for incoming traffic
	// for provider endpoints.
	//
	// For example, ":8083" binds to all interfaces on port 8083, while "localhost:8083" only
	// binds to local interfaces (no external traffic).
	ProviderAddress string `yaml:"provider_address" default:":8083"`

	// OperatorAddress configures host and port where Valkyrie will attempt to listen for incoming traffic
	// for operator endpoints.
	OperatorAddress string        `yaml:"operator_address" default:":8084"`
	ReadTimeout     time.Duration `yaml:"read_timeout" default:"3s"`  // The amount of time allowed to read the full request including body
	WriteTimeout    time.Duration `yaml:"write_timeout" default:"3s"` // The maximum duration before timing out writes of the response
	IdleTimeout     time.Duration `yaml:"idle_timeout" default:"30s"` // The maximum amount of time to wait for the next request when keep-alive is enabled
}

HTTPServerConfig Configuration used for valkyrie servers

type LogConfig

type LogConfig struct {
	Level  string          `yaml:"level" default:"info"`
	Output OutputLogConfig `yaml:"output"`
	Async  AsyncLogConfig  `yaml:"async"`
}

LogConfig configuration setup for logging

type MetricConfig added in v0.7.0

type MetricConfig struct {
	ExporterType string `yaml:"type,omitempty"`
	URL          string `yaml:"url,omitempty"`
}

MetricConfig Configuration setup for metrics

type OutputLogConfig

type OutputLogConfig struct {
	// Type configures where to output logs.
	// Supported types: "stdout", "stderr", "file"
	Type string `yaml:"type" default:"stdout"`

	// Filename is the file to write logs to.  Backup log files will be retained
	// in the same directory.
	Filename string `yaml:"filename,omitempty"`

	// MaxSize is the maximum size in megabytes of the log file before it gets
	// rotated. It defaults to 100 megabytes.
	MaxSize int `yaml:"max_size,omitempty"`

	// MaxAge is the maximum number of days to retain old log files based on the
	// timestamp encoded in their filename. The default is not to remove old log files
	// based on age.
	MaxAge int `yaml:"max_age,omitempty"`

	// MaxBackups is the maximum number of old log files to retain.  The default
	// is to retain all old log files (though MaxAge may still cause them to get
	// deleted.)
	MaxBackups int `yaml:"max_backups,omitempty"`

	// Compress determines if the rotated log files should be compressed
	// using gzip. The default is not to perform compression.
	Compress bool `yaml:"compress,omitempty"`
}

OutputLogConfig Configuration for logging output

type PamConf

type PamConf = map[string]any

PamConf Configured information for the used Player Account Manager/wallet

type ProviderConf

type ProviderConf struct {
	// Name of the provider
	Name string `yaml:"name"`
	// Auth Authorization configuration for a specific provider.
	Auth map[string]any `yaml:"auth"`
	// ProviderSpecific Any other config specific to each provider
	ProviderSpecific map[string]any `yaml:"provider_specific,omitempty"`
	// URL url to use for example gamelaunch
	URL string `yaml:"url"`
	// BasePath used to distinguish endpoints exposed by Valkyrie
	BasePath string `yaml:"base_path,omitempty"`
}

ProviderConf Configuration structure for provider

type TelemetryConfig added in v0.7.0

type TelemetryConfig struct {
	Metric      MetricConfig `yaml:"metric,omitempty"`
	ServiceName string       `yaml:"service_name" default:"valkyrie"`
	Namespace   string       `yaml:"namespace,omitempty"`
	Tracing     TraceConfig  `yaml:"tracing,omitempty"`
}

TelemetryConfig holds general configuration for telemetry (tracing & metrics)

type TraceConfig

type TraceConfig struct {
	TraceType       string  `yaml:"type,omitempty"`
	URL             string  `yaml:"url,omitempty"`
	GoogleProjectID string  `yaml:"google_project_id,omitempty"`
	SampleRatio     float64 `yaml:"sample_ratio" default:"0.01"`
}

TraceConfig Configuration setup for tracing

type ValkyrieConfig

type ValkyrieConfig struct {
	HTTPServer       HTTPServerConfig `yaml:"http_server"`
	Pam              PamConf          `yaml:"pam"`
	Telemetry        TelemetryConfig  `yaml:"telemetry,omitempty"`
	Providers        []ProviderConf   `yaml:"providers,flow"`
	ProviderBasePath string           `yaml:"provider_base_path,omitempty"`
	// APIKey used as bearer token to access operator endpoints
	OperatorAPIKey   string           `yaml:"operator_api_key,omitempty"`
	OperatorBasePath string           `yaml:"operator_base_path,omitempty"`
	Version          string           `yaml:"-"`
	Logging          LogConfig        `yaml:"logging,omitempty"`
	HTTPClient       HTTPClientConfig `yaml:"http_client"`
}

ValkyrieConfig Parsed valkyrie configuration

func Read

func Read(file *string) (*ValkyrieConfig, error)

Read reads yaml file at provided location and parse it into a `ValkyrieConfig`

Jump to

Keyboard shortcuts

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