catbase/config/defaults.go

29 lines
534 B
Go
Raw Normal View History

package config
import (
2019-03-07 16:35:42 +00:00
"github.com/rs/zerolog/log"
)
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"},
}
if nick == mainChannel && nick == "" {
2019-03-07 16:35:42 +00:00
log.Fatal().Msgf("You must provide a nick and a mainChannel")
}
2021-12-21 19:30:02 +00:00
for _, v := range values {
err := c.store.Insert(v.Key, v)
if err != nil {
panic(err)
}
}
2021-12-21 19:30:02 +00:00
2019-03-07 16:35:42 +00:00
log.Info().Msgf("Configuration initialized.")
}