Rename ticktickutil, add interface for di
This commit is contained in:
@@ -21,11 +21,14 @@ import (
|
||||
"github.com/t-liu93/home-automation-backend/components/locationRecorder"
|
||||
"github.com/t-liu93/home-automation-backend/components/pooRecorder"
|
||||
"github.com/t-liu93/home-automation-backend/util/notion"
|
||||
"github.com/t-liu93/home-automation-backend/util/ticktick"
|
||||
"github.com/t-liu93/home-automation-backend/util/ticktickutil"
|
||||
)
|
||||
|
||||
var port string
|
||||
var scheduler gocron.Scheduler
|
||||
var (
|
||||
port string
|
||||
scheduler gocron.Scheduler
|
||||
ticktick *ticktickutil.TicktickUtilImpl
|
||||
)
|
||||
|
||||
// serveCmd represents the serve command
|
||||
var serveCmd = &cobra.Command{
|
||||
@@ -43,7 +46,7 @@ func initUtil() {
|
||||
os.Exit(1)
|
||||
}
|
||||
// init ticktick
|
||||
ticktick.Init()
|
||||
ticktick = ticktickutil.Init()
|
||||
}
|
||||
|
||||
func initComponent() {
|
||||
@@ -51,6 +54,8 @@ func initComponent() {
|
||||
pooRecorder.Init(&scheduler)
|
||||
// init location recorder
|
||||
locationRecorder.Init()
|
||||
// init homeassistant
|
||||
homeassistant.Init(ticktick)
|
||||
}
|
||||
|
||||
func serve(cmd *cobra.Command, args []string) {
|
||||
|
||||
Reference in New Issue
Block a user