configs

package
v0.0.0-...-9dac649 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Environment variable keys
	EnvDBHostKey = "MYSQL_HOST"
	EnvDBPortKey = "MYSQL_PORT"
	EnvDBUserKey = "MYSQL_USER"
	EnvDBPassKey = "MYSQL_PASS"
	EnvDBNameKey = "MYSQL_DBNAME"

	// Default values
	DefaultDBHost = "database"
	DefaultDBPort = 3306
	DefaultDBUser = "canary"
	DefaultDBPass = "canary"
	DefaultDBName = "canary"
)
View Source
const (
	// Environment variable keys
	EnvServerIpKey       = "SERVER_IP"
	EnvServerLocationKey = "SERVER_LOCATION"
	EnvServerNameKey     = "SERVER_NAME"
	EnvServerPortKey     = "SERVER_PORT"
	EnvVocations         = "VOCATIONS"

	// Default values
	DefaultServerIpKey       = "127.0.0.1"
	DefaultServerLocationKey = "AUS"
	DefaultServerNameKey     = "OTServBR-Global"
	DefaultServerPortKey     = 7172
	DefaultVocations         = ""
)
View Source
const (
	// Environment variable keys
	EnvLoginIpKey          = "LOGIN_IP"
	EnvLoginHttpPortKey    = "LOGIN_HTTP_PORT"
	EnvLoginGrpcPortKey    = "LOGIN_GRPC_PORT"
	EnvRateLimiterBurstKey = "RATE_LIMITER_BURST"
	EnvRateLimiterRateKey  = "RATE_LIMITER_RATE"
	EnvLogLevel            = "ENV_LOG_LEVEL"

	// Default values
	DefaultLoginIpKey          = "0.0.0.0"
	DefaultLoginHttpPortKey    = 80
	DefaultLoginGrpcPortKey    = 9090
	DefaultRateLimiterBurstKey = 5
	DefaultRateLimiterRateKey  = 2
	DefaultLogLevel            = "ENV_LOG_LEVEL"
)

Variables

This section is empty.

Functions

func GetLogLevel

func GetLogLevel() logrus.Level

func GetServerVocations

func GetServerVocations() []string

Types

type Config

type Config interface {
	Format() string
}

type DBConfigs

type DBConfigs struct {
	Host string
	Port int
	Name string
	User string
	Pass string
}

func GetDBConfigs

func GetDBConfigs() DBConfigs

func (*DBConfigs) Format

func (dbConfigs *DBConfigs) Format() string

Format returns a string representation of the DBConfigs

func (*DBConfigs) GetConnectionString

func (dbConfigs *DBConfigs) GetConnectionString() string

GetConnectionString returns the database connection string

type GameServerConfigs

type GameServerConfigs struct {
	Port     int
	Name     string
	IP       string
	Location string
	Config
}

func GetGameServerConfigs

func GetGameServerConfigs() GameServerConfigs

func (*GameServerConfigs) Format

func (gameServerConfigs *GameServerConfigs) Format() string

type GlobalConfigs

type GlobalConfigs struct {
	DBConfigs          DBConfigs
	GameServerConfigs  GameServerConfigs
	LoginServerConfigs LoginServerConfigs
}

func GetGlobalConfigs

func GetGlobalConfigs() GlobalConfigs

func (*GlobalConfigs) Display

func (c *GlobalConfigs) Display()

type GrpcLoginConfigs

type GrpcLoginConfigs struct {
	Ip   string
	Port int
	Config
}

func (*GrpcLoginConfigs) Format

func (grpcLoginConfigs *GrpcLoginConfigs) Format() string

type HttpLoginConfigs

type HttpLoginConfigs struct {
	Ip   string
	Port int
	Config
}

func (*HttpLoginConfigs) Format

func (httpLoginConfigs *HttpLoginConfigs) Format() string

type LoginServerConfigs

type LoginServerConfigs struct {
	Http        HttpLoginConfigs
	Grpc        GrpcLoginConfigs
	RateLimiter RateLimiter
	Config
}

func GetLoginServerConfigs

func GetLoginServerConfigs() LoginServerConfigs

func (*LoginServerConfigs) Format

func (loginServerConfigs *LoginServerConfigs) Format() string

type RateLimiter

type RateLimiter struct {
	Burst int
	Rate  rate.Limit
	Config
}

func GetRateLimiterConfigs

func GetRateLimiterConfigs() RateLimiter

func (*RateLimiter) Format

func (rateLimiterConfigs *RateLimiter) Format() string

Jump to

Keyboard shortcuts

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