Skip to content

Commit

Permalink
cmd/node: figure out unused viper.Get call TODOs
Browse files Browse the repository at this point in the history
They were both needed, but for different reasons.
Keep them but document them.
  • Loading branch information
mvdan authored and p4u committed Dec 21, 2023
1 parent 1ca3a1a commit e636621
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@ func loadConfig() *config.Config {

viper.BindFlagValues(pflagValueSet{flag.CommandLine})

conf.Vochain.DBType = viper.GetString("dbType") // TODO: unused?
conf.Vochain.Indexer.ArchiveURL = viper.GetString("archiveURL") // TODO: unused?

// use different datadirs for different networks
conf.DataDir = filepath.Join(viper.GetString("dataDir"), viper.GetString("chain"))
viper.Set("dataDir", conf.DataDir)
Expand All @@ -239,7 +236,8 @@ func loadConfig() *config.Config {
viper.Set("vochain.DataDir", filepath.Join(conf.DataDir, "vochain"))
viper.Set("vochain.ProcessArchiveDataDir", filepath.Join(conf.DataDir, "archive"))

// propagate dev to vochain.Dev
// propagate some keys to the vochain category
viper.Set("vochain.dbType", viper.GetString("dbType"))
viper.Set("vochain.Dev", viper.GetBool("dev"))

// add viper config path (now we know it)
Expand Down Expand Up @@ -269,6 +267,8 @@ func loadConfig() *config.Config {
if err != nil {
log.Fatalf("cannot unmarshal loaded config file: %s", err)
}
// Note that conf.Vochain.Indexer isn't bound with viper.
conf.Vochain.Indexer.ArchiveURL = viper.GetString("archiveURL")

if conf.SigningKey == "" {
log.Info("no signing key, generating one...")
Expand Down

0 comments on commit e636621

Please sign in to comment.