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:"politeiawww host"` RawJSON bool `short:"j" long:"json" description:"Print raw JSON output"` ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` SkipVerify bool `long:"skipverify" description:"Skip verifying the server's certifcate chain and host name"` Verbose bool `short:"v" long:"verbose" description:"Print verbose output"` Silent bool `long:"silent" description:"Suppress all output"` DataDir string // Application data dir 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 }
Config represents the politeiawwwcli configuration settings.
func Load ¶
Load initializes and parses the config using a config file and command line options.
The configuration proceeds as follows:
- Start with a default config with sane settings
- Pre-parse the command line to check for an alternative config file
- Load configuration file overwriting defaults with any specified options
- Parse CLI options and overwrite/add any specified options
The above results in politeiawwwcli 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) SaveCookies ¶
SaveCookies writes the passed in cookies to the host specific cookie file.
func (*Config) SaveIdentity ¶
func (cfg *Config) SaveIdentity(user string, id *identity.FullIdentity) error
SaveIdentity writes the passed in user identity to disk so that it can be persisted between commands. The prepend the hostname and the username onto the idenity filename so that we can keep track of the identities for multiple users per host.
func (*Config) SaveLoggedInUsername ¶
SaveLoggedInUsername saved the passed in username to the on-disk user file. We persist the logged in username between commands so that we know which identity to load.