2019-01-21 19:24:03 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2019-03-07 16:35:42 +00:00
|
|
|
"github.com/rs/zerolog/log"
|
2019-01-21 19:24:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (c *Config) SetDefaults(mainChannel, nick string) {
|
2021-12-21 19:30:02 +00:00
|
|
|
values := []Value{
|
|
|
|
{"nick", nick},
|
|
|
|
{"channels", mainChannel},
|
|
|
|
{"untappd.channels", mainChannel},
|
|
|
|
{"twitch.channels", mainChannel},
|
|
|
|
{"init", "1"},
|
|
|
|
}
|
|
|
|
|
2019-01-21 19:24:03 +00:00
|
|
|
if nick == mainChannel && nick == "" {
|
2019-03-07 16:35:42 +00:00
|
|
|
log.Fatal().Msgf("You must provide a nick and a mainChannel")
|
2019-01-21 19:24:03 +00:00
|
|
|
}
|
2021-12-21 19:30:02 +00:00
|
|
|
|
|
|
|
for _, v := range values {
|
|
|
|
err := c.store.Insert(v.Key, v)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2019-01-21 19:24:03 +00:00
|
|
|
}
|
2021-12-21 19:30:02 +00:00
|
|
|
|
2019-03-07 16:35:42 +00:00
|
|
|
log.Info().Msgf("Configuration initialized.")
|
2019-01-21 19:24:03 +00:00
|
|
|
}
|