ambient-local-exporter/main.go

50 lines
962 B
Go
Raw Normal View History

2025-01-04 18:15:19 +00:00
package main
import (
"context"
"os"
"os/signal"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/app"
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv"
"golang.org/x/sys/unix"
"gitea.libretechconsulting.com/rmcguire/ambient-weather-local-exporter/pkg/ambient"
)
func main() {
ctx, cncl := signal.NotifyContext(context.Background(), os.Kill, unix.SIGTERM)
defer cncl()
ctx = app.MustSetupConfigAndLogging(ctx)
2025-01-05 01:54:36 +00:00
aw := ambient.New(ctx)
aw.MustInit()
2025-01-04 18:15:19 +00:00
awApp := app.App{
AppContext: ctx,
HTTP: &app.AppHTTP{
Funcs: []srv.HTTPFunc{
{
Path: "/weatherstation/updateweatherstation.php",
2025-01-05 01:54:36 +00:00
HandlerFunc: aw.GetWundergroundHandlerFunc(ctx),
2025-01-04 18:15:19 +00:00
},
{
Path: "/data/report",
2025-01-05 01:54:36 +00:00
HandlerFunc: aw.GetAWNHandlerFunc(ctx),
2025-01-04 18:15:19 +00:00
},
},
HealthChecks: []srv.HealthCheckFunc{
// TODO: Implement
func(ctx context.Context) error {
return nil
},
},
},
}
awApp.MustRun()
<-awApp.Done()
}