35 lines
752 B
Go
35 lines
752 B
Go
package history
|
|
|
|
import (
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/spf13/viper"
|
|
"kumoly.io/kumoly/app/store"
|
|
"kumoly.io/kumoly/app/system"
|
|
)
|
|
|
|
type Service struct {
|
|
system.BaseService
|
|
}
|
|
|
|
func (srv Service) GetName() string { return "history.Service" }
|
|
func (srv Service) IsService() bool { return true }
|
|
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()
|
|
}
|