Documentation ¶
Index ¶
- Variables
- func DefaultHostByNetwork(network dex.Network) string
- func FilePathToURL(name string) (string, error)
- func InitLogging(logFilename, lvl string, stdout bool, utc bool) (lm *dex.LoggerMaker, closeFn func())
- func ParseCLIConfig(cfg any) error
- func ParseFileConfig(path string, cfg any) error
- func ResolveCLIConfigPaths(cfg *Config) (appData, configPath string)
- func ResolveConfig(appData string, cfg *Config) error
- type Config
- type CoreConfig
- type LogConfig
- type MMConfig
- type RPCConfig
- type WebConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{ AppData: defaultApplicationDirectory, ConfigPath: defaultConfigPath, LogConfig: LogConfig{DebugLevel: defaultLogLevel}, RPCConfig: RPCConfig{ CertHosts: []string{defaultTestnetHost, defaultSimnetHost, defaultMainnetHost}, }, }
var ( // Version is the application version per the semantic versioning 2.0.0 spec // (https://semver.org/). // // It is defined as a variable so it can be overridden during the build // process with: // '-ldflags "-X main.Version=fullsemver"' // if needed. // // It MUST be a full semantic version per the semantic versioning spec or // the package will panic at runtime. Of particular note is the pre-release // and build metadata portions MUST only contain characters from // semanticAlphabet. // NOTE: The Version string is overridden on init. Version = "1.0.2+release.local" )
Functions ¶
func DefaultHostByNetwork ¶
DefaultHostByNetwork accepts configured network and returns the network specific default host
func FilePathToURL ¶
func InitLogging ¶
func InitLogging(logFilename, lvl string, stdout bool, utc bool) (lm *dex.LoggerMaker, closeFn func())
initLogging initializes the logging rotater to write logs to logFile and create roll files in the same directory. initLogging must be called before the package-global log rotator variables are used.
func ParseCLIConfig ¶
ParseCLIConfig parses the command-line arguments into the provided struct with go-flags tags. If the --help flag has been passed, the struct is described back to the terminal and the program exits using os.Exit.
func ParseFileConfig ¶
ParseFileConfig parses the INI file into the provided struct with go-flags tags. The CLI args are then parsed, and take precedence over the file values.
func ResolveCLIConfigPaths ¶
ResolveCLIConfigPaths resolves the app data directory path and the configuration file path from the CLI config, (presumably parsed with ParseCLIConfig).
func ResolveConfig ¶
ResolveConfig sets derivative fields of the Config struct using the specified app data directory (presumably returned from ResolveCLIConfigPaths). Some unset values are given defaults.
Types ¶
type Config ¶
type Config struct { CoreConfig RPCConfig WebConfig LogConfig MMConfig // AppData and ConfigPath should be parsed from the command-line, // as it makes no sense to set these in the config file itself. If no values // are assigned, defaults will be used. AppData string `long:"appdata" description:"Path to application directory."` ConfigPath string `long:"config" description:"Path to an INI configuration file."` // Testnet and Simnet are used to set the derivative CoreConfig.Net // dex.Network field. Testnet bool `long:"testnet" description:"use testnet"` Simnet bool `long:"simnet" description:"use simnet"` RPCOn bool `long:"rpc" description:"turn on the rpc server"` NoWeb bool `long:"noweb" description:"disable the web server."` CPUProfile string `long:"cpuprofile" description:"File for CPU profiling."` ShowVer bool `short:"V" long:"version" description:"Display version information and exit"` Language string `long:"lang" description:"BCP 47 tag for preferred language, e.g. en-GB, fr, zh-CN"` }
Config is the common application configuration definition. This composite struct captures the configuration needed for core and both web and rpc servers, as well as some application-level directives.
type CoreConfig ¶
type CoreConfig struct { DBPath string `long:"db" description:"Database filepath. Database will be created if it does not exist."` Onion string `long:"onion" description:"Proxy for .onion addresses, if torproxy not set (eg. 127.0.0.1:9050)."` TorProxy string `long:"torproxy" description:"Connect via TOR (eg. 127.0.0.1:9050)."` TorIsolation bool `long:"torisolation" description:"Enable TOR circuit isolation."` // Net is a derivative field set by ResolveConfig. Net dex.Network TheOneHost string `long:"onehost" description:"Only connect with this server."` NoAutoWalletLock bool `` /* 172-byte string literal not displayed */ NoAutoDBBackup bool `long:"no-db-backup" description:"Disable creation of a database backup on shutdown."` UnlockCoinsOnLogin bool `` /* 136-byte string literal not displayed */ ExtensionModeFile string `long:"extension-mode-file" description:"path to a file that specifies options for running core as an extension."` PruneArchive uint64 `` /* 128-byte string literal not displayed */ }
CoreConfig encapsulates the settings specific to core.Core.
type LogConfig ¶
type LogConfig struct { LogPath string `long:"logpath" description:"A file to save app logs"` DebugLevel string `long:"log" description:"Logging level {trace, debug, info, warn, error, critical}"` LocalLogs bool `long:"loglocal" description:"Use local time zone time stamps in log entries."` }
LogConfig encapsulates the logging-related settings.
type MMConfig ¶
type MMConfig struct { BotConfigPath string `long:"botConfigPath"` EventLogDBPath string `long:"eventLogDBPath"` }
MMConfig encapsulates the settings specific to market making.
type RPCConfig ¶
type RPCConfig struct { RPCAddr string `long:"rpcaddr" description:"RPC server listen address"` RPCUser string `long:"rpcuser" description:"RPC server user name"` RPCPass string `long:"rpcpass" description:"RPC server password"` RPCCert string `long:"rpccert" description:"RPC server certificate file location"` RPCKey string `long:"rpckey" description:"RPC server key file location"` // CertHosts is a list of hosts given to certgen.NewTLSCertPair for the // "Subject Alternate Name" values of the generated TLS certificate. It is // set automatically, not via the config file or cli args. CertHosts []string }
RPCConfig encapsulates the configuration needed for the RPC server.
type WebConfig ¶
type WebConfig struct { WebAddr string `long:"webaddr" description:"HTTP server address"` WebTLS bool `` /* 239-byte string literal not displayed */ SiteDir string `` /* 127-byte string literal not displayed */ NoEmbedSite bool `` /* 168-byte string literal not displayed */ HTTPProfile bool `long:"httpprof" description:"Start HTTP profiler on /pprof."` // Deprecated Experimental bool `long:"experimental" description:"DEPRECATED: Enable experimental features"` }
WebConfig encapsulates the configuration needed for the web server.