config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2019 License: ISC Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HomeDir     string `long:"appdata" description:"Path to application home directory"`
	Host        string `long:"host" description:"hcAutonomywww host"`
	RawJSON     bool   `short:"j" long:"json" description:"Print raw JSON output"`
	ShowVersion bool   `short:"V" long:"version" description:"Display version information and exit"`
	Verbose     bool   `short:"v" long:"verbose" description:"Print verbose output"`

	Version string // cli version

	WalletHost string // Wallet host
	WalletCert string // Wallet GRPC certificate
	FaucetHost string // Testnet faucet host
	CSRF       string // CSRF header token

	Identity *identity.FullIdentity // User identity
	Cookies  []*http.Cookie         // User cookies
	// contains filtered or unexported fields
}

func Load

func Load() (*Config, error)

Load initializes and parses the config using a config file and command line options.

The configuration proceeds as follows:

  1. Start with a default config with sane settings
  2. Pre-parse the command line to check for an alternative config file
  3. Load configuration file overwriting defaults with any specified options
  4. Parse CLI options and overwrite/add any specified options

The above results in hcAutonomywwwcli functioning properly without any config settings while still allowing the user to override settings with config files and command line options. Command line options always take precedence.

func (*Config) SaveCSRF

func (cfg *Config) SaveCSRF(csrf string) error

func (*Config) SaveCookies

func (cfg *Config) SaveCookies(cookies []*http.Cookie) error

func (*Config) SaveIdentity

func (cfg *Config) SaveIdentity(id *identity.FullIdentity) error

Jump to

Keyboard shortcuts

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