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.
36 lines
911 B
36 lines
911 B
package main
|
|
|
|
import "github.com/spf13/viper"
|
|
import log "github.com/sirupsen/logrus"
|
|
|
|
// STEEM_APIURL=https://api.steem.house ./steem-block-db
|
|
|
|
func main() {
|
|
viper.SetConfigName("steem")
|
|
viper.AddConfigPath("/etc/steem")
|
|
viper.AddConfigPath("$HOME/.config/steem")
|
|
viper.SetEnvPrefix("steem")
|
|
viper.BindEnv("debug")
|
|
viper.BindEnv("redis")
|
|
viper.BindEnv("apiurl")
|
|
viper.ReadInConfig() // Find and read the config file if exists
|
|
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")
|
|
}
|
|
app := NewApp(&appconfig{
|
|
logLevel: logLevel,
|
|
apiUrl: apiurl,
|
|
redisUrl: redis,
|
|
desiredFetcherThreads: 30,
|
|
})
|
|
app.main()
|
|
}
|
|
|