You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package app
import ( "context" "fmt" "git.aiterp.net/lucifer/new-server/app/api" "git.aiterp.net/lucifer/new-server/app/config" "git.aiterp.net/lucifer/new-server/app/services" "git.aiterp.net/lucifer/new-server/app/services/publisher" "git.aiterp.net/lucifer/new-server/models" "github.com/gin-gonic/gin" "log" "time" )
func StartServer() { setupCtx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel()
err := publisher.Initialize(setupCtx) if err != nil { log.Fatalln("Publish init failed:", err) return }
services.StartEventHandler() services.ConnectToBridges() services.CheckNewDevices()
gin.SetMode(gin.ReleaseMode) ginny := gin.New()
apiGin := ginny.Group("/api") api.Bridges(apiGin.Group("/bridges")) api.Devices(apiGin.Group("/devices")) api.ColorPresets(apiGin.Group("/color-presets")) api.DriverKinds(apiGin.Group("/driver-kinds")) api.Events(apiGin.Group("/events")) api.EventHandlers(apiGin.Group("/event-handlers")) api.Scenes(apiGin.Group("/scenes"))
models.TimeOfDayTimeZone = config.Location()
log.Fatal(ginny.Run(fmt.Sprintf("0.0.0.0:%d", config.ServerPort()))) }
|