Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

bugfix:fix debug mod and homedir config in yaml #990

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions cmd/supernode/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ var rootCmd = &cobra.Command{
Args: cobra.NoArgs,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
// load config file.
if err := readConfigFile(supernodeViper, cmd); err != nil {
return errors.Wrap(err, "read config file")
}

// get config from viper.
cfg, err := getConfigFromViper(supernodeViper)
if err != nil {
return errors.Wrap(err, "get config from viper")
}

// create home dir
if err := fileutils.CreateDirectory(supernodeViper.GetString("base.homeDir")); err != nil {
return fmt.Errorf("failed to create home dir %s: %v", supernodeViper.GetString("base.homeDir"), err)
Expand All @@ -67,17 +78,6 @@ var rootCmd = &cobra.Command{
return err
}

// load config file
if err := readConfigFile(supernodeViper, cmd); err != nil {
return errors.Wrap(err, "read config file")
}

// get config from viper
cfg, err := getConfigFromViper(supernodeViper)
if err != nil {
return errors.Wrap(err, "get config from viper")
}

// set supernode advertise ip
if stringutils.IsEmptyStr(cfg.AdvertiseIP) {
if err := setAdvertiseIP(cfg); err != nil {
Expand Down