puerta/main.go

50 lines
1.1 KiB
Go
Raw Normal View History

2022-12-30 06:51:51 +00:00
// SPDX-License-Identifier: Apache-2.0
// Copyright © 2022 Roberto Hidalgo <nidito@un.rob.mx>
package main
import (
"os"
"git.rob.mx/nidito/chinampa"
"git.rob.mx/nidito/chinampa/pkg/runtime"
2023-04-16 21:17:36 +00:00
"git.rob.mx/nidito/puerta/cmd/admin"
"git.rob.mx/nidito/puerta/cmd/db"
"git.rob.mx/nidito/puerta/cmd/hue"
"git.rob.mx/nidito/puerta/cmd/server"
2022-12-30 06:51:51 +00:00
"github.com/sirupsen/logrus"
)
func main() {
logrus.SetFormatter(&logrus.TextFormatter{
DisableLevelTruncation: true,
DisableTimestamp: true,
ForceColors: runtime.ColorEnabled(),
})
if runtime.DebugEnabled() {
logrus.SetLevel(logrus.DebugLevel)
logrus.Debug("Debugging enabled")
}
cfg := chinampa.Config{
Name: "puerta",
Version: "0.0.0",
Summary: "opens the door to my house",
Description: "Does other door related stuff too.",
}
2023-04-16 21:17:36 +00:00
chinampa.Register(
admin.UserAddCommand,
admin.UserReset2faCommand,
hue.SetupHueCommand,
hue.TestHueCommand,
server.ServerCommand,
db.MigrationsCommand,
)
2022-12-30 06:51:51 +00:00
if err := chinampa.Execute(cfg); err != nil {
logrus.Errorf("total failure: %s", err)
os.Exit(2)
}
}