Skip to content

Commit

Permalink
feat(cmd): berty daemon auth options
Browse files Browse the repository at this point in the history
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
  • Loading branch information
90dy committed Oct 24, 2018
1 parent d06ff3c commit 27dbfaf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/cmd/berty/daemon.go
Expand Up @@ -28,9 +28,14 @@ type daemonOptions struct {
transportP2P []string `mapstructure:"transport-p2p"`
hop bool `mapstructure:"hop"` // relay hop
mdns bool `mapstructure:"mdns"`

nickname string `mapstructure:"nickname"`
password string `mapstructure:"password"`
}

func daemonSetupFlags(flags *pflag.FlagSet, opts *daemonOptions) {
flags.StringVar(&opts.nickname, "nickname", "berty-daemon", "set account nickname")
flags.StringVar(&opts.password, "password", "secure", "set account password")
flags.BoolVar(&opts.dropDatabase, "drop-database", false, "drop database to force a reinitialization")
flags.BoolVar(&opts.hideBanner, "hide-banner", false, "hide banner")
flags.BoolVar(&opts.initOnly, "init-only", false, "stop after node initialization (useful for integration tests")
Expand Down Expand Up @@ -71,8 +76,8 @@ func daemon(opts *daemonOptions) error {
a := &account.Account{}

accountOptions := account.Options{
account.WithName("berty-daemon"),
account.WithPassphrase("secure"),
account.WithName(opts.nickname),
account.WithPassphrase(opts.password),
account.WithDatabase(&account.DatabaseOptions{
Path: "/tmp",
Drop: opts.dropDatabase,
Expand Down

0 comments on commit 27dbfaf

Please sign in to comment.