Add homeassistant to ticktick
This commit is contained in:
@@ -21,6 +21,7 @@ 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"
|
||||
)
|
||||
|
||||
var port string
|
||||
@@ -41,6 +42,8 @@ func initUtil() {
|
||||
slog.Error("Notion token not found in config file, exiting..")
|
||||
os.Exit(1)
|
||||
}
|
||||
// init ticktick
|
||||
ticktick.Init()
|
||||
}
|
||||
|
||||
func initComponent() {
|
||||
@@ -55,8 +58,8 @@ func serve(cmd *cobra.Command, args []string) {
|
||||
|
||||
viper.SetConfigName("config") // name of config file (without extension)
|
||||
viper.SetConfigType("yaml")
|
||||
viper.AddConfigPath(".") // . is used for dev
|
||||
viper.AddConfigPath("$HOME/.config/home-automation")
|
||||
viper.AddConfigPath(".") // optionally look for config in the working directory
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
slog.Error(fmt.Sprintf("Cannot read config file, %s, exiting..", err))
|
||||
@@ -105,6 +108,8 @@ func serve(cmd *cobra.Command, args []string) {
|
||||
|
||||
router.HandleFunc("/location/record", locationRecorder.HandleRecordLocation).Methods("POST")
|
||||
|
||||
router.HandleFunc("/ticktick/auth/code", ticktick.HandleAuthCode).Methods("GET")
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: ":" + port,
|
||||
Handler: router,
|
||||
|
||||
Reference in New Issue
Block a user