Use single cert/key for RPC by default.

Also, while here, set the default RPC cert/key in the initial config
struct so the default will show when displaying the usage.
This commit is contained in:
Dave Collins 2013-11-19 11:37:22 -06:00
parent 6fcc1c9d1b
commit 9a853fdf90

View file

@ -36,6 +36,8 @@ var (
defaultDataDir = filepath.Join(btcdHomeDir, defaultDataDirname)
defaultListener = net.JoinHostPort("", netParams(defaultBtcnet).listenPort)
knownDbTypes = btcdb.SupportedDBs()
defaultRPCKeyFile = filepath.Join(btcdHomeDir, "rpc.key")
defaultRPCCertFile = filepath.Join(btcdHomeDir, "rpc.cert")
)
// config defines the configuration options for btcd.
@ -180,6 +182,8 @@ func loadConfig() (*config, []string, error) {
ConfigFile: defaultConfigFile,
DataDir: defaultDataDir,
DbType: defaultDbType,
RPCKey: defaultRPCKeyFile,
RPCCert: defaultRPCCertFile,
}
// Pre-parse the command line options to see if an alternative config
@ -342,13 +346,6 @@ func loadConfig() (*config, []string, error) {
}
}
if cfg.RPCKey == "" {
cfg.RPCKey = filepath.Join(cfg.DataDir, "rpc.key")
}
if cfg.RPCCert == "" {
cfg.RPCCert = filepath.Join(cfg.DataDir, "rpc.cert")
}
// Add default port to all listener addresses if needed and remove
// duplicate addresses.
cfg.Listeners = normalizeAddresses(cfg.Listeners,