Add adminpass config item.

This commit is contained in:
jholdstock 2020-06-08 12:44:02 +01:00 committed by David Hill
parent 9f02063c86
commit 144060c3cb
4 changed files with 9 additions and 0 deletions

View File

@ -52,6 +52,7 @@ type config struct {
SupportEmail string `long:"supportemail" ini-name:"supportemail" description:"Email address for users in need of support."` SupportEmail string `long:"supportemail" ini-name:"supportemail" description:"Email address for users in need of support."`
BackupInterval time.Duration `long:"backupinterval" ini-name:"backupinterval" description:"Time period between automatic database backups. Valid time units are {s,m,h}. Minimum 30 seconds."` BackupInterval time.Duration `long:"backupinterval" ini-name:"backupinterval" description:"Time period between automatic database backups. Valid time units are {s,m,h}. Minimum 30 seconds."`
VspClosed bool `long:"vspclosed" ini-name:"vspclosed" description:"Closed prevents the VSP from accepting new tickets."` VspClosed bool `long:"vspclosed" ini-name:"vspclosed" description:"Closed prevents the VSP from accepting new tickets."`
AdminPass string `long:"adminpass" ini-name:"adminpass" description:"Password for accessing admin page."`
// The following flags should be set on CLI only, not via config file. // The following flags should be set on CLI only, not via config file.
FeeXPub string `long:"feexpub" no-ini:"true" description:"Cold wallet xpub used for collecting fees. Should be provided once to initialize a vspd database."` FeeXPub string `long:"feexpub" no-ini:"true" description:"Cold wallet xpub used for collecting fees. Should be provided once to initialize a vspd database."`
@ -271,6 +272,11 @@ func loadConfig() (*config, error) {
return nil, errors.New("the supportemail option is not set") return nil, errors.New("the supportemail option is not set")
} }
// Ensure the administrator password is set.
if cfg.AdminPass == "" {
return nil, errors.New("the adminpass option is not set")
}
// Ensure the dcrd RPC username is set. // Ensure the dcrd RPC username is set.
if cfg.DcrdUser == "" { if cfg.DcrdUser == "" {
return nil, errors.New("the dcrduser option is not set") return nil, errors.New("the dcrduser option is not set")

View File

@ -125,6 +125,7 @@ webserverdebug = false
supportemail = example@test.com supportemail = example@test.com
backupinterval = 3m0s backupinterval = 3m0s
vspclosed = false vspclosed = false
adminpass=12345
EOF EOF
tmux new-window -t $TMUX_SESSION -n "vspd" tmux new-window -t $TMUX_SESSION -n "vspd"

View File

@ -88,6 +88,7 @@ func run(ctx context.Context) error {
NetParams: cfg.netParams.Params, NetParams: cfg.netParams.Params,
SupportEmail: cfg.SupportEmail, SupportEmail: cfg.SupportEmail,
VspClosed: cfg.VspClosed, VspClosed: cfg.VspClosed,
AdminPass: cfg.AdminPass,
} }
err = webapi.Start(ctx, shutdownRequestChannel, &shutdownWg, cfg.Listen, db, err = webapi.Start(ctx, shutdownRequestChannel, &shutdownWg, cfg.Listen, db,
dcrd, wallets, cfg.WebServerDebug, apiCfg) dcrd, wallets, cfg.WebServerDebug, apiCfg)

View File

@ -24,6 +24,7 @@ type Config struct {
FeeAccountName string FeeAccountName string
SupportEmail string SupportEmail string
VspClosed bool VspClosed bool
AdminPass string
} }
const ( const (