config

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config provides configurations for subcommands.

Default values can be obtained from various sources (constants, environment variables, etc.) and then overridden by flags.

As configuration is global you can get it only once for safety: you can call only one of Get… functions and call it just once.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(flagsets FlagSets) error

Init updates config defaults (from env) and setup subcommands flags.

Init must be called once before using this package.

Types

type FlagSets

type FlagSets struct {
	Serve *pflag.FlagSet
}

FlagSets for all CLI subcommands which use flags to set config values.

type ServeConfig

type ServeConfig struct {
	AccessLog             bool
	Addr                  netx.Addr
	AutosavePeriod        time.Duration
	DepthProfitChange     float64
	DigBaseDelay          time.Duration
	DigExtraDelay         time.Duration
	Duration              time.Duration
	Game                  game.Config
	LicenseMaxDelay       time.Duration
	LicenseMinDelay       time.Duration
	LicensePercentFail    int
	LicensePercentTimeout int
	LicenseTimeoutDelay   time.Duration
	MetricsAddr           netx.Addr
	OpCashPercentFail     int
	OpCashRate            int
	OpDigRate             int
	OpDigTimeout          time.Duration
	OpExploreAreaRate     int
	OpExploreAreaTimeout  time.Duration
	OpGetBalanceRate      int
	OpIssueLicenseRate    int
	OpListLicensesRate    int
	Pprof                 bool
	ResultDir             string
	StartTimeout          time.Duration
	WorkDir               string
}

ServeConfig contains configuration for subcommand.

func GetServe

func GetServe() (c *ServeConfig, err error)

GetServe validates and returns configuration for subcommand.

func MustGetServeTest

func MustGetServeTest() *ServeConfig

MustGetServeTest returns config suitable for use in tests.

Jump to

Keyboard shortcuts

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