Skip to content

Commit

Permalink
deprecate unused dcrstakepool datadir config option (#507)
Browse files Browse the repository at this point in the history
* deprecate unused dcrstakepool datadir config option

* remove datadir config setting from test harness
  • Loading branch information
itswisdomagain authored and dajohi committed Aug 28, 2019
1 parent 02f5c4e commit a94b696
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
19 changes: 6 additions & 13 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const (
defaultBaseURL = "http://127.0.0.1:8000"
defaultClosePoolMsg = "The voting service is temporarily closed to new signups."
defaultConfigFilename = "dcrstakepool.conf"
defaultDataDirname = "data"
defaultLogLevel = "info"
defaultLogDirname = "logs"
defaultLogFilename = "dcrstakepool.log"
Expand All @@ -53,7 +52,6 @@ const (
var (
dcrstakepoolHomeDir = dcrutil.AppDataDir("dcrstakepool", false)
defaultConfigFile = filepath.Join(dcrstakepoolHomeDir, defaultConfigFilename)
defaultDataDir = filepath.Join(dcrstakepoolHomeDir, defaultDataDirname)
defaultLogDir = filepath.Join(dcrstakepoolHomeDir, defaultLogDirname)
coldWalletFeeKey *hdkeychain.ExtendedKey
votingWalletVoteKey *hdkeychain.ExtendedKey
Expand All @@ -69,7 +67,7 @@ var runServiceCommand func(string) error
type config struct {
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"`
DataDir string `short:"b" long:"datadir" description:"Directory to store data"`
DataDir string `short:"b" long:"datadir" description:"Deprecated. Unused, do not set."`
LogDir string `long:"logdir" description:"Directory to log output."`
Listen string `long:"listen" description:"Listen for connections on the specified interface/port (default all interfaces port: 9113, testnet: 19113)"`
TestNet bool `long:"testnet" description:"Use the test network"`
Expand Down Expand Up @@ -320,7 +318,6 @@ func loadConfig() (*config, []string, error) {
ClosePoolMsg: defaultClosePoolMsg,
ConfigFile: defaultConfigFile,
DebugLevel: defaultLogLevel,
DataDir: defaultDataDir,
LogDir: defaultLogDir,
CookieSecure: defaultCookieSecure,
DBHost: defaultDBHost,
Expand Down Expand Up @@ -450,15 +447,6 @@ func loadConfig() (*config, []string, error) {
return nil, nil, err
}

// Append the network type to the data directory so it is "namespaced"
// per network. In addition to the block database, there are other
// pieces of data that are saved to disk such as address manager state.
// All data is specific to a network, so namespacing the data directory
// means each individual piece of serialized data does not have to
// worry about changing names per network and such.
cfg.DataDir = cleanAndExpandPath(cfg.DataDir)
cfg.DataDir = filepath.Join(cfg.DataDir, netName(activeNetParams))

// Append the network type to the log directory so it is "namespaced"
// per network in the same fashion as the data directory.
cfg.LogDir = cleanAndExpandPath(cfg.LogDir)
Expand Down Expand Up @@ -633,6 +621,11 @@ func loadConfig() (*config, []string, error) {
}

// Warn about deprecated config items if they have been set
if cfg.DataDir != "" {
str := "%s: Config datadir is deprecated. Please remove from your config file"
log.Warnf(str, funcName)
}

if cfg.EnableStakepoold {
str := "%s: Config enablestakepoold is deprecated. Please remove from your config file"
log.Warnf(str, funcName)
Expand Down
1 change: 0 additions & 1 deletion harness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ echo ""
echo "Writing config for dcrstakepool"
mkdir -p "${NODES_ROOT}/dcrstakepool"
cat > "${NODES_ROOT}/dcrstakepool/dcrstakepool.conf" <<EOF
datadir=${NODES_ROOT}/dcrstakepool
logdir=${NODES_ROOT}/dcrstakepool/log
votingwalletextpub=${VOTING_WALLET_DEFAULT_ACCT_PUB_KEY}
apisecret=not_very_secret_at_all
Expand Down

0 comments on commit a94b696

Please sign in to comment.