catbase/config/defaults.go

29 lines
534 B
Go

package config
import (
"github.com/rs/zerolog/log"
)
func (c *Config) SetDefaults(mainChannel, nick string) {
values := []Value{
{"nick", nick},
{"channels", mainChannel},
{"untappd.channels", mainChannel},
{"twitch.channels", mainChannel},
{"init", "1"},
}
if nick == mainChannel && nick == "" {
log.Fatal().Msgf("You must provide a nick and a mainChannel")
}
for _, v := range values {
err := c.store.Insert(v.Key, v)
if err != nil {
panic(err)
}
}
log.Info().Msgf("Configuration initialized.")
}