2018-10-04 18:41:39 +00:00
|
|
|
package main
|
|
|
|
|
2018-11-03 15:32:24 +00:00
|
|
|
import "github.com/spf13/viper"
|
2018-10-31 08:48:53 +00:00
|
|
|
import log "github.com/sirupsen/logrus"
|
2018-10-04 18:41:39 +00:00
|
|
|
|
2018-11-03 15:32:24 +00:00
|
|
|
// STEEM_APIURL=https://api.steem.house ./steem-block-db
|
2018-10-18 07:09:30 +00:00
|
|
|
|
2018-10-04 18:41:39 +00:00
|
|
|
func main() {
|
2018-11-03 15:32:24 +00:00
|
|
|
viper.SetConfigName("steem")
|
|
|
|
viper.AddConfigPath("/etc/steem")
|
|
|
|
viper.AddConfigPath("$HOME/.config/steem")
|
|
|
|
viper.SetEnvPrefix("steem")
|
|
|
|
viper.BindEnv("debug")
|
|
|
|
viper.BindEnv("redis")
|
|
|
|
viper.BindEnv("apiurl")
|
2018-11-12 05:34:55 +00:00
|
|
|
viper.ReadInConfig() // Find and read the config file if exists
|
2018-11-03 15:32:24 +00:00
|
|
|
logLevel := log.InfoLevel
|
|
|
|
if viper.GetBool("debug") == true {
|
|
|
|
logLevel = log.DebugLevel
|
|
|
|
}
|
|
|
|
redis := "localhost:6379"
|
|
|
|
if viper.Get("redis") != nil {
|
|
|
|
redis = viper.GetString("redis")
|
|
|
|
}
|
|
|
|
apiurl := "https://api.steemit.com"
|
|
|
|
if viper.Get("apiurl") != nil {
|
|
|
|
apiurl = viper.GetString("apiurl")
|
|
|
|
}
|
2018-11-01 03:35:30 +00:00
|
|
|
app := NewApp(&appconfig{
|
2018-11-03 15:32:24 +00:00
|
|
|
logLevel: logLevel,
|
|
|
|
apiUrl: apiurl,
|
|
|
|
redisUrl: redis,
|
2018-11-12 05:34:55 +00:00
|
|
|
desiredFetcherThreads: 30,
|
2018-11-01 03:35:30 +00:00
|
|
|
})
|
2018-10-31 08:48:53 +00:00
|
|
|
app.main()
|
|
|
|
}
|