You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
911B

  1. package main
  2. import "github.com/spf13/viper"
  3. import log "github.com/sirupsen/logrus"
  4. // STEEM_APIURL=https://api.steem.house ./steem-block-db
  5. func main() {
  6. viper.SetConfigName("steem")
  7. viper.AddConfigPath("/etc/steem")
  8. viper.AddConfigPath("$HOME/.config/steem")
  9. viper.SetEnvPrefix("steem")
  10. viper.BindEnv("debug")
  11. viper.BindEnv("redis")
  12. viper.BindEnv("apiurl")
  13. viper.ReadInConfig() // Find and read the config file if exists
  14. logLevel := log.InfoLevel
  15. if viper.GetBool("debug") == true {
  16. logLevel = log.DebugLevel
  17. }
  18. redis := "localhost:6379"
  19. if viper.Get("redis") != nil {
  20. redis = viper.GetString("redis")
  21. }
  22. apiurl := "https://api.steemit.com"
  23. if viper.Get("apiurl") != nil {
  24. apiurl = viper.GetString("apiurl")
  25. }
  26. app := NewApp(&appconfig{
  27. logLevel: logLevel,
  28. apiUrl: apiurl,
  29. redisUrl: redis,
  30. desiredFetcherThreads: 30,
  31. })
  32. app.main()
  33. }