config

package
v0.0.0-...-555310e Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConfig

func CreateConfig()

CreateConfig initiates the configuration creation process by collecting user input for various configuration values and then writes the configuration file to disk if successful, otherwise panics.

func CreateDebugConfig

func CreateDebugConfig()

CreateDebugConfig creates the configuration file that is used when running the applciation in debug mode.

func CreateTestConfig

func CreateTestConfig()

CreateTestConfig creates the configuration that is used when running automated testing.

func InitConfig

func InitConfig()

InitConfig reads the configuration file from disk and if successful, sets the application wide-configuration. Otherwise, it will panic.

Types

type Cfg

type Cfg struct {
	LogConfig   CfgLog   `json:"logConfig"`
	SteamConfig CfgSteam `json:"steamConfig"`
	WebConfig   CfgWeb   `json:"webConfig"`
	DebugConfig CfgDebug `json:"debugConfig"`
}

Cfg represents logging, steam-related, and API-related options.

var Config *Cfg

Config represents the application-wide configuration.

type CfgDebug

type CfgDebug struct {
	// stdout "debug" msgs
	EnableDebugMessages bool `json:"debugMessages"`
	// dump server JSON to disk
	EnableServerDump bool `json:"dumpServers"`
	// use a pre-defined server JSON file as the master list for API (for testing)
	ServerDumpFileAsMasterList bool `json:"useServerDumpAsMaster"`
	// name of the pre-defined server JSON file to use as master list
	ServerDumpFilename string `json:"serverDumpFilename"`
}

CfgDebug represents options for debugging and development.

type CfgLog

type CfgLog struct {
	EnableAppLogging   bool  `json:"enableAppLogging"`
	EnableSteamLogging bool  `json:"enableSteamLogging"`
	EnableWebLogging   bool  `json:"enableWebLogging"`
	MaximumLogSize     int64 `json:"maxLogFilesize"`
	MaximumLogCount    int   `json:"maxLogCount"`
}

CfgLog represents logging-related configuration options.

type CfgSteam

type CfgSteam struct {
	AutoQueryMaster          bool   `json:"timedMasterServerQuery"`
	SteamWebAPIKey           string `json:"steamWebAPIKey"`
	UseWebServerList         bool   `json:"useWebServerList"`
	AutoQueryGame            string `json:"gameForTimedMasterQuery"`
	TimeBetweenMasterQueries int    `json:"timeBetweenMasterQueries"`
	MaximumHostsToReceive    int    `json:"maxHostsToReceive"`
}

CfgSteam represents Steam-related configuration options.

type CfgWeb

type CfgWeb struct {
	AllowDirectUserQueries  bool `json:"allowDirectUserQueries"`
	APIWebPort              int  `json:"apiWebPort"`
	APIWebTimeout           int  `json:"apiWebTimeout"`
	CompressResponses       bool `json:"compressResponses"`
	MaximumHostsPerAPIQuery int  `json:"maxHostsPerAPIQuery"`
}

CfgWeb represents web-related API configuration options.

Jump to

Keyboard shortcuts

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