From 144060c3cb9f9a2b6c8b596b6c1c0203aae79bd6 Mon Sep 17 00:00:00 2001 From: jholdstock Date: Mon, 8 Jun 2020 12:44:02 +0100 Subject: [PATCH] Add adminpass config item. --- config.go | 6 ++++++ harness.sh | 1 + main.go | 1 + webapi/webapi.go | 1 + 4 files changed, 9 insertions(+) diff --git a/config.go b/config.go index cda4531..190e8fd 100644 --- a/config.go +++ b/config.go @@ -52,6 +52,7 @@ type config struct { 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."` 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. 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") } + // 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. if cfg.DcrdUser == "" { return nil, errors.New("the dcrduser option is not set") diff --git a/harness.sh b/harness.sh index a4743db..b2f478d 100755 --- a/harness.sh +++ b/harness.sh @@ -125,6 +125,7 @@ webserverdebug = false supportemail = example@test.com backupinterval = 3m0s vspclosed = false +adminpass=12345 EOF tmux new-window -t $TMUX_SESSION -n "vspd" diff --git a/main.go b/main.go index 849c580..d6d84c9 100644 --- a/main.go +++ b/main.go @@ -88,6 +88,7 @@ func run(ctx context.Context) error { NetParams: cfg.netParams.Params, SupportEmail: cfg.SupportEmail, VspClosed: cfg.VspClosed, + AdminPass: cfg.AdminPass, } err = webapi.Start(ctx, shutdownRequestChannel, &shutdownWg, cfg.Listen, db, dcrd, wallets, cfg.WebServerDebug, apiCfg) diff --git a/webapi/webapi.go b/webapi/webapi.go index fc3dd1c..59d8dd6 100644 --- a/webapi/webapi.go +++ b/webapi/webapi.go @@ -24,6 +24,7 @@ type Config struct { FeeAccountName string SupportEmail string VspClosed bool + AdminPass string } const (