app/history/service.go

38 lines
905 B
Go

package history
import (
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"kumoly.io/kumoly/app/store"
)
type Service struct {
}
func (srv Service) GetName() string { return "history.Service" }
func (srv Service) IsService() bool { return true }
func (srv Service) GetDependencies() []string { return []string{"server.Service"} }
func (srv Service) Init() error {
PROD = viper.GetBool("prod")
l := log.With().Str("mod", "history").
Str("service", "history.Service").
Logger()
l.Debug().Msg("Migrating database for history.Service ...")
if err := store.Migrate(&History{}); err != nil {
l.Error().Err(err).Msg("Migrating database")
return err
}
return nil
}
func (srv Service) Main() error {
Start(DBReceiver)
return nil
}
func (srv Service) Del() {
Stop()
}
func (srv Service) Load() error { return nil }
func (srv Service) Health() error { return nil }