config

package
v2.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 6 Imported by: 42

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCustomMetricsSpec

func NewCustomMetricsSpec(config *Config) *models.CustomMetricsSpec

NewCustomMetricsSpec returns a *CustomMetricsSpec by reading config key (DEPRECATED)

func NewDefaultCustomMetricsSpec

func NewDefaultCustomMetricsSpec() *models.CustomMetricsSpec

NewDefaultCustomMetricsSpec returns an empty *CustomMetricsSpec

Types

type ClusterConfig added in v2.10.0

type ClusterConfig struct {
	Info InfoRetrieverConfig `mapstructure:"info"`
	RPC  ClusterRPCConfig    `mapstructure:"rpc"`
	SD   ClusterSDConfig     `mapstructure:"sd"`
}

type ClusterRPCConfig added in v2.10.0

type ClusterRPCConfig struct {
	Client struct {
		Grpc GRPCClientConfig    `mapstructure:"grpc"`
		Nats NatsRPCClientConfig `mapstructure:"nats"`
	} `mapstructure:"client"`
	Server struct {
		Grpc GRPCServerConfig    `mapstructure:"grpc"`
		Nats NatsRPCServerConfig `mapstructure:"nats"`
	} `mapstructure:"server"`
}

type ClusterSDConfig added in v2.10.0

type ClusterSDConfig struct {
	Etcd EtcdServiceDiscoveryConfig `mapstructure:"etcd"`
}

type Config

type Config struct {
	viper.Viper
}

Config is a wrapper around a viper config

func NewConfig

func NewConfig(cfgs ...*viper.Viper) *Config

NewConfig creates a new config with a given viper config if given

func (*Config) UnmarshalKey

func (c *Config) UnmarshalKey(key string, rawVal interface{}) error

UnmarshalKey unmarshals key into v

type ETCDBindingConfig

type ETCDBindingConfig struct {
	DialTimeout time.Duration `mapstructure:"dialtimeout"`
	Endpoints   []string      `mapstructure:"endpoints"`
	Prefix      string        `mapstructure:"prefix"`
	LeaseTTL    time.Duration `mapstructure:"leasettl"`
}

ETCDBindingConfig provides configuration for ETCDBindingStorage

type EnqueueOpts

type EnqueueOpts struct {
	Enabled     bool `mapstructure:"enabled"`
	Max         int  `mapstructure:"max"`
	Exponential int  `mapstructure:"exponential"`
	MinDelay    int  `mapstructure:"mindelay"`
	MaxDelay    int  `mapstructure:"maxdelay"`
	MaxRandom   int  `mapstructure:"maxrandom"`
}

EnqueueOpts has retry options for worker

type EtcdGroupServiceConfig

type EtcdGroupServiceConfig struct {
	DialTimeout        time.Duration `mapstructure:"dialtimeout"`
	Endpoints          []string      `mapstructure:"endpoints"`
	Prefix             string        `mapstructure:"prefix"`
	TransactionTimeout time.Duration `mapstructure:"transactiontimeout"`
}

EtcdGroupServiceConfig provides ETCD configuration

type EtcdServiceDiscoveryConfig

type EtcdServiceDiscoveryConfig struct {
	Endpoints   []string      `mapstructure:"endpoints"`
	User        string        `mapstructure:"user"`
	Pass        string        `mapstructure:"pass"`
	DialTimeout time.Duration `mapstructure:"dialtimeout"`
	Prefix      string        `mapstructure:"prefix"`
	Heartbeat   struct {
		TTL time.Duration `mapstructure:"ttl"`
		Log bool          `mapstructure:"log"`
	} `mapstructure:"heartbeat"`
	SyncServers struct {
		Interval    time.Duration `mapstructure:"interval"`
		Parallelism int           `mapstructure:"parallelism"`
	} `mapstructure:"syncservers"`
	Revoke struct {
		Timeout time.Duration `mapstructure:"timeout"`
	} `mapstructure:"revoke"`
	GrantLease struct {
		Timeout       time.Duration `mapstructure:"timeout"`
		MaxRetries    int           `mapstructure:"maxretries"`
		RetryInterval time.Duration `mapstructure:"retryinterval"`
	} `mapstructure:"grantlease"`
	Shutdown struct {
		Delay time.Duration `mapstructure:"delay"`
	} `mapstructure:"shutdown"`
	ServerTypesBlacklist []string `mapstructure:"servertypesblacklist"`
}

EtcdServiceDiscoveryConfig Etcd service discovery config

type GRPCClientConfig

type GRPCClientConfig struct {
	DialTimeout    time.Duration `mapstructure:"dialtimeout"`
	LazyConnection bool          `mapstructure:"lazyconnection"`
	RequestTimeout time.Duration `mapstructure:"requesttimeout"`
}

GRPCClientConfig rpc client config struct

type GRPCServerConfig

type GRPCServerConfig struct {
	Port int `mapstructure:"port"`
}

GRPCServerConfig provides configuration for GRPCServer

type GroupsConfig added in v2.10.0

type GroupsConfig struct {
	Etcd   EtcdGroupServiceConfig `mapstructure:"etcd"`
	Memory MemoryGroupConfig      `mapstructure:"memory"`
}

type InfoRetrieverConfig

type InfoRetrieverConfig struct {
	Region string `mapstructure:"region"`
}

InfoRetrieverConfig provides InfoRetriever configuration

type MemoryGroupConfig

type MemoryGroupConfig struct {
	TickDuration time.Duration `mapstructure:"tickduration"`
}

MemoryGroupConfig provides configuration for MemoryGroup

type MetricsConfig added in v2.10.0

type MetricsConfig struct {
	Period           time.Duration            `mapstructure:"period"`
	Game             string                   `mapstructure:"game"`
	AdditionalLabels map[string]string        `mapstructure:"additionallabels"`
	ConstLabels      map[string]string        `mapstructure:"constlabels"`
	Custom           models.CustomMetricsSpec `mapstructure:"custom"`
	Prometheus       *PrometheusConfig        `mapstructure:"prometheus"`
	Statsd           *StatsdConfig            `mapstructure:"statsd"`
}

Metrics provides configuration for all metrics related configurations

type ModulesConfig added in v2.10.0

type ModulesConfig struct {
	BindingStorage struct {
		Etcd ETCDBindingConfig `mapstructure:"etcd"`
	} `mapstructure:"bindingstorage"`
}

ModulesConfig provides configuration for Pitaya Modules

type NatsRPCClientConfig

type NatsRPCClientConfig struct {
	Connect                string        `mapstructure:"connect"`
	MaxReconnectionRetries int           `mapstructure:"maxreconnectionretries"`
	RequestTimeout         time.Duration `mapstructure:"requesttimeout"`
	ConnectionTimeout      time.Duration `mapstructure:"connectiontimeout"`
}

NatsRPCClientConfig provides nats client configuration

type NatsRPCServerConfig

type NatsRPCServerConfig struct {
	Connect                string `mapstructure:"connect"`
	MaxReconnectionRetries int    `mapstructure:"maxreconnectionretries"`
	Buffer                 struct {
		Messages int `mapstructure:"messages"`
		Push     int `mapstructure:"push"`
	} `mapstructure:"buffer"`
	Services          int           `mapstructure:"services"`
	ConnectionTimeout time.Duration `mapstructure:"connectiontimeout"`
}

NatsRPCServerConfig provides nats server configuration

type PitayaConfig

type PitayaConfig struct {
	SerializerType   uint16 `mapstructure:"serializertype"`
	DefaultPipelines struct {
		StructValidation struct {
			Enabled bool `mapstructure:"enabled"`
		} `mapstructure:"structvalidation"`
	} `mapstructure:"defaultpipelines"`
	Modules   ModulesConfig
	Heartbeat struct {
		Interval time.Duration `mapstructure:"interval"`
	} `mapstructure:"heartbeat"`
	Handler struct {
		Messages struct {
			Compression bool `mapstructure:"compression"`
		} `mapstructure:"messages"`
	} `mapstructure:"handler"`
	Buffer struct {
		Agent struct {
			Messages int `mapstructure:"messages"`
		} `mapstructure:"agent"`
		Handler struct {
			LocalProcess  int `mapstructure:"localprocess"`
			RemoteProcess int `mapstructure:"remoteprocess"`
		} `mapstructure:"handler"`
	} `mapstructure:"buffer"`
	Concurrency struct {
		Handler struct {
			Dispatch int `mapstructure:"dispatch"`
		} `mapstructure:"handler"`
	} `mapstructure:"concurrency"`
	Session struct {
		Unique bool `mapstructure:"unique"`
		Drain  struct {
			Enabled bool          `mapstructure:"enabled"`
			Timeout time.Duration `mapstructure:"timeout"`
			Period  time.Duration `mapstructure:"period"`
		} `mapstructure:"drain"`
	} `mapstructure:"session"`

	Acceptor struct {
		ProxyProtocol bool `mapstructure:"proxyprotocol"`
	} `mapstructure:"acceptor"`
	Conn struct {
		RateLimiting RateLimitingConfig `mapstructure:"rateLimiting"`
	} `mapstructure:"conn"`
	Metrics MetricsConfig `mapstructure:"metrics"`
	Cluster ClusterConfig `mapstructure:"cluster"`
	Groups  GroupsConfig  `mapstructure:"groups"`
	Worker  WorkerConfig  `mapstructure:"worker"`
}

PitayaConfig provides all the configuration for a pitaya app

func NewDefaultPitayaConfig

func NewDefaultPitayaConfig() *PitayaConfig

NewDefaultPitayaConfig provides default configuration for Pitaya App

func NewPitayaConfig

func NewPitayaConfig(config *Config) *PitayaConfig

NewPitayaConfig returns a config instance with values extracted from default config paths

type PrometheusConfig

type PrometheusConfig struct {
	Port    int  `mapstructure:"port"`
	Enabled bool `mapstructure:"enabled"`
}

PrometheusConfig provides configuration for PrometheusReporter

type RateLimitingConfig

type RateLimitingConfig struct {
	Limit        int           `mapstructure:"limit"`
	Interval     time.Duration `mapstructure:"interval"`
	ForceDisable bool          `mapstructure:"forcedisable"`
}

RateLimitingConfig rate limits config

type StatsdConfig

type StatsdConfig struct {
	Enabled bool    `mapstructure:"enabled"`
	Host    string  `mapstructure:"host"`
	Prefix  string  `mapstructure:"prefix"`
	Rate    float64 `mapstructure:"rate"`
}

StatsdConfig provides configuration for statsd

type WorkerConfig

type WorkerConfig struct {
	Redis struct {
		ServerURL string `mapstructure:"serverurl"`
		Pool      string `mapstructure:"pool"`
		Password  string `mapstructure:"password"`
	} `mapstructure:"redis"`
	Namespace   string      `mapstructure:"namespace"`
	Concurrency int         `mapstructure:"concurrency"`
	Retry       EnqueueOpts `mapstructure:"retry"`
}

WorkerConfig provides worker configuration

Jump to

Keyboard shortcuts

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