Tidy hard-coded strings.
This commit is contained in:
parent
c91ec5c697
commit
a412e3e8b9
15
config.go
15
config.go
@ -18,20 +18,25 @@ import (
|
|||||||
"decred.org/dcrwallet/v2/wallet/txrules"
|
"decred.org/dcrwallet/v2/wallet/txrules"
|
||||||
"github.com/decred/dcrd/dcrutil/v4"
|
"github.com/decred/dcrd/dcrutil/v4"
|
||||||
"github.com/decred/dcrd/hdkeychain/v3"
|
"github.com/decred/dcrd/hdkeychain/v3"
|
||||||
|
"github.com/decred/slog"
|
||||||
"github.com/decred/vspd/database"
|
"github.com/decred/vspd/database"
|
||||||
"github.com/decred/vspd/version"
|
"github.com/decred/vspd/version"
|
||||||
flags "github.com/jessevdk/go-flags"
|
flags "github.com/jessevdk/go-flags"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const appName = "vspd"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
defaultListen = ":8800"
|
defaultListen = ":8800"
|
||||||
defaultLogLevel = "debug"
|
defaultLogLevel = slog.LevelDebug.String()
|
||||||
defaultMaxLogSize = int64(10)
|
defaultMaxLogSize = int64(10)
|
||||||
defaultLogsToKeep = 20
|
defaultLogsToKeep = 20
|
||||||
defaultVSPFee = 3.0
|
defaultVSPFee = 3.0
|
||||||
defaultNetwork = "testnet"
|
defaultNetwork = "testnet"
|
||||||
defaultHomeDir = dcrutil.AppDataDir("vspd", false)
|
defaultHomeDir = dcrutil.AppDataDir(appName, false)
|
||||||
defaultConfigFilename = "vspd.conf"
|
defaultConfigFilename = fmt.Sprintf("%s.conf", appName)
|
||||||
|
defaultLogFilename = fmt.Sprintf("%s.log", appName)
|
||||||
|
defaultDBFilename = fmt.Sprintf("%s.db", appName)
|
||||||
defaultConfigFile = filepath.Join(defaultHomeDir, defaultConfigFilename)
|
defaultConfigFile = filepath.Join(defaultHomeDir, defaultConfigFilename)
|
||||||
defaultDcrdHost = "127.0.0.1"
|
defaultDcrdHost = "127.0.0.1"
|
||||||
defaultWalletHost = "127.0.0.1"
|
defaultWalletHost = "127.0.0.1"
|
||||||
@ -403,11 +408,11 @@ func loadConfig() (*config, error) {
|
|||||||
|
|
||||||
// Initialize loggers and log rotation.
|
// Initialize loggers and log rotation.
|
||||||
logDir := filepath.Join(cfg.HomeDir, "logs", cfg.netParams.Name)
|
logDir := filepath.Join(cfg.HomeDir, "logs", cfg.netParams.Name)
|
||||||
initLogRotator(filepath.Join(logDir, "vspd.log"), cfg.MaxLogSize, cfg.LogsToKeep)
|
initLogRotator(filepath.Join(logDir, defaultLogFilename), cfg.MaxLogSize, cfg.LogsToKeep)
|
||||||
setLogLevels(cfg.LogLevel)
|
setLogLevels(cfg.LogLevel)
|
||||||
|
|
||||||
// Set the database path
|
// Set the database path
|
||||||
cfg.dbPath = filepath.Join(dataDir, "vspd.db")
|
cfg.dbPath = filepath.Join(dataDir, defaultDBFilename)
|
||||||
|
|
||||||
// If xpub has been provided, create a new database and exit.
|
// If xpub has been provided, create a new database and exit.
|
||||||
if cfg.FeeXPub != "" {
|
if cfg.FeeXPub != "" {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user