Documentation ¶
Index ¶
- Variables
- func AbsDir(dir string) (string, error)
- func AddDir(list []string, dirs ...string) ([]string, error)
- func DirExists(fpath string) (bool, error)
- func FileExists(fpath string) (bool, error)
- func InitConfig()
- func LookupDir(list []string, fname string) string
- func LookupInLocations(env, sub, fname string) (fpath string)
- func StringInSlice(a string, list []string) bool
- type CfgGameplay
- type CfgJwtAuth
- type CfgXormDrv
- type Config
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Developer mode, running at debugger. DevMode bool // AppName is name of this application without extension. AppName = util.PathName(os.Args[0]) // Executable path. ExePath string // Configuration file with path. CfgFile string // Configuration path. CfgPath string // SQLite-files path. SqlPath string )
View Source
var ( XormStorage *xorm.Engine XormSpinlog *xorm.Engine )
View Source
var ( // compiled binary version, sets by compiler with command // go build -ldflags="-X 'github.com/slotopol/server/config.BuildVers=%buildvers%'" BuildVers string // compiled binary build date, sets by compiler with command // go build -ldflags="-X 'github.com/slotopol/server/config.BuildTime=%buildtime%'" BuildTime string )
View Source
var Cfg = &Config{ CfgJwtAuth: CfgJwtAuth{ AccessTTL: 1 * 24 * time.Hour, RefreshTTL: 3 * 24 * time.Hour, AccessKey: "skJgM4NsbP3fs4k7vh0gfdkgGl8dJTszdLxZ1sQ9ksFnxbgvw2RsGH8xxddUV479", RefreshKey: "zxK4dUnuq3Lhd1Gzhpr3usI5lAzgvy2t3fmxld2spzz7a5nfv0hsksm9cheyutie", NonceTimeout: 150 * time.Second, }, CfgGameplay: CfgGameplay{ AdjunctLimit: 100000, MaxSpinAttempts: 300, }, CfgXormDrv: CfgXormDrv{ XormDriverName: "sqlite3", }, }
Instance of common service settings. Inits default values if config is not found.
View Source
var (
ErrNoCfgFile = errors.New("configyration file was not found")
)
Functions ¶
func InitConfig ¶
func InitConfig()
func LookupInLocations ¶
func StringInSlice ¶
Types ¶
type CfgGameplay ¶
type CfgGameplay struct { // Maximum value to add to wallet by one transaction. AdjunctLimit float64 `json:"adjunct-limit" yaml:"adjunct-limit" mapstructure:"adjunct-limit"` // Maximum number of spin attempts at bad bank balance. MaxSpinAttempts int `json:"max-spin-attempts" yaml:"max-spin-attempts" mapstructure:"max-spin-attempts"` }
type CfgJwtAuth ¶
type CfgJwtAuth struct { AccessTTL time.Duration `json:"access-ttl" yaml:"access-ttl" mapstructure:"access-ttl"` RefreshTTL time.Duration `json:"refresh-ttl" yaml:"refresh-ttl" mapstructure:"refresh-ttl"` AccessKey string `json:"access-key" yaml:"access-key" mapstructure:"access-key"` RefreshKey string `json:"refresh-key" yaml:"refresh-key" mapstructure:"refresh-key"` NonceTimeout time.Duration `json:"nonce-timeout" yaml:"nonce-timeout" mapstructure:"nonce-timeout"` }
type CfgXormDrv ¶
type CfgXormDrv struct { // Provides XORM driver name. XormDriverName string `json:"xorm-driver-name" yaml:"xorm-driver-name" mapstructure:"xorm-driver-name"` }
type Config ¶
type Config struct { CfgJwtAuth `json:"authentication" yaml:"authentication" mapstructure:"authentication"` CfgGameplay `json:"gameplay" yaml:"xorm" mapstructure:"gameplay"` CfgXormDrv `json:"xorm" yaml:"xorm" mapstructure:"xorm"` }
Config is common service settings.
Click to show internal directories.
Click to hide internal directories.