config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CnfAdmin

type CnfAdmin struct {
	UserName string
	Password string
}

CnfAdmin is configuration about initial admin user authorization

type CnfAuth

type CnfAuth struct {
	BaseURL string `validate:"url"`
	Cookie  string
	Salt    string
	Key     string `validate:"len=16"`
	State   string

	Twitter CnfTwitter
	Google  CnfOAuth
	GitHub  CnfOAuth
}

CnfAuth is auth section of secret.conf

type CnfBackup

type CnfBackup struct {
	Enabled  bool
	Interval duration
}

CnfBackup is configuration about backup interval

type CnfCompany

type CnfCompany struct {
	Attract float64 `validate:"gt=0"`
}

type CnfDatabase

type CnfDatabase struct {
	Driver string `validation:"oneof=mysql"`
	Spec   string
}

CnfDatabase is configuration about connectiing user data stored database

type CnfEntity

type CnfEntity struct {
	MaxScale  float64 `toml:"max_scale" validate:"gtfield=MinScale"`
	MinScale  float64 `toml:"min_scale" validate:"ltfield=MaxScale"`
	Residence CnfResidence
	Company   CnfCompany
	Gate      CnfGate
	Platform  CnfPlatform
	Train     CnfTrain
	Human     CnfHuman
}

CnfEntity is entity section of game.conf

type CnfGame

type CnfGame struct {
	Entity  CnfEntity
	Service CnfService
}

CnfGame is root element of game.conf

type CnfGate

type CnfGate struct {
	Num int `validate:"gt=0"`
}

CnfGate is configuration about gate

type CnfHuman

type CnfHuman struct {
	Speed float64 `validate:"gt=0"`
}

CnfHuman is configuration about human

type CnfOAuth

type CnfOAuth struct {
	Client string
	Secret string
}

CnfOAuth is general configuration about OAuth

type CnfPerf

type CnfPerf struct {
	View      duration
	Game      duration
	Operation duration
	Routing   duration
	Backup    duration
	Restore   duration
	Init      duration
}

CnfPerf is configuration about performance logging

type CnfPlatform

type CnfPlatform struct {
	Capacity  int     `validate:"gt=0"`
	Randomize float64 `validate:"gte=0"`
}

CnfPlatform is configuration about platform

type CnfProcedure

type CnfProcedure struct {
	Interval   duration
	Queue      uint `validate:"gt=0"`
	Simulation bool
}

CnfProcedure is configuration about game proceding

type CnfResidence

type CnfResidence struct {
	Interval  duration
	Capacity  int     `validate:"gt=0"`
	Randomize float64 `validate:"gte=0"`
}

CnfResidence is configuration about residence

type CnfRouting

type CnfRouting struct {
	Worker int `validate:"gt=0"`
	Alert  int `validate:"gte=0"`
}

CnfRouting is configuration about paralization

type CnfSecret

type CnfSecret struct {
	Admin CnfAdmin
	Auth  CnfAuth
	DB    CnfDatabase
}

CnfSecret is root section of secret.conf

type CnfService

type CnfService struct {
	Procedure CnfProcedure
	Routing   CnfRouting
	Backup    CnfBackup
	Perf      CnfPerf
}

CnfService is service section of game.conf

type CnfTrain

type CnfTrain struct {
	Speed     float64 `validate:"gt=0"`
	Capacity  int     `validate:"gt=0"`
	Mobility  int     `validate:"gt=0"`
	Slowness  float64 `validate:"gt=0,lte=1"`
	Randomize float64 `validate:"gte=0"`
}

CnfTrain is configuration about train

type CnfTwitter

type CnfTwitter struct {
	Token        string
	Secret       string
	Request      string `validate:"url"`
	Authenticate string `validate:"url"`
	AccessToken  string `validate:"url"`
}

CnfTwitter is configuration about Twitter OAuth

type Config

type Config struct {
	Game   CnfGame
	Secret CnfSecret
}

Config stores configurable variables

func Load

func Load(confDir string) (*Config, error)

Load load and validate game.conf/secret.conf

Jump to

Keyboard shortcuts

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