Skip to content

Commit

Permalink
Add adminpass config item.
Browse files Browse the repository at this point in the history
  • Loading branch information
jholdstock committed Jun 8, 2020
1 parent 0318ede commit 805f491
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."`
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions harness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions webapi/webapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Config struct {
FeeAccountName string
SupportEmail string
VspClosed bool
AdminPass string
}

const (
Expand Down

0 comments on commit 805f491

Please sign in to comment.