Skip to content

Commit

Permalink
fix(config): cli command error
Browse files Browse the repository at this point in the history
  • Loading branch information
indes committed Jun 28, 2019
1 parent 853a21e commit b7a1f5e
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions config/autoload.go
Expand Up @@ -48,23 +48,36 @@ func init() {
if *telegramTokenCli == "" {
BotToken = viper.GetString("bot_token")

} else {
BotToken = *telegramTokenCli
}

if *socks5Cli == "" {
Socks5 = viper.GetString("socks5")
} else {
Socks5 = *socks5Cli
}

if *telegraphTokenCli == "" && viper.IsSet("telegraph_token") {
EnableTelegraph = true
TelegraphToken = viper.GetString("telegraph_token")
if *telegraphTokenCli == "" {
if viper.IsSet("telegraph_token") {
EnableTelegraph = true
TelegraphToken = viper.GetString("telegraph_token")
} else {
EnableTelegraph = false
}
} else {
EnableTelegraph = false
EnableTelegraph = true
TelegraphToken = *telegramTokenCli
}

if *intervalCli == 0 && viper.IsSet("update_interval") {
UpdateInterval = viper.GetInt("update_interval")
if *intervalCli == 0 {
if viper.IsSet("update_interval") {
UpdateInterval = viper.GetInt("update_interval")
} else {
UpdateInterval = 10
}
} else {
UpdateInterval = 10
UpdateInterval = *intervalCli
}

if viper.IsSet("mysql.host") {
Expand Down

0 comments on commit b7a1f5e

Please sign in to comment.