Start Ambient local exporter
This commit is contained in:
46
main.go
Normal file
46
main.go
Normal file
@@ -0,0 +1,46 @@
|
||||
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)
|
||||
|
||||
awApp := app.App{
|
||||
AppContext: ctx,
|
||||
HTTP: &app.AppHTTP{
|
||||
Funcs: []srv.HTTPFunc{
|
||||
{
|
||||
Path: "/weatherstation/updateweatherstation.php",
|
||||
HandlerFunc: ambient.GetWundergroundHandlerFunc(ctx),
|
||||
},
|
||||
{
|
||||
Path: "/data/report",
|
||||
HandlerFunc: ambient.GetAWNHandlerFunc(ctx),
|
||||
},
|
||||
},
|
||||
HealthChecks: []srv.HealthCheckFunc{
|
||||
// TODO: Implement
|
||||
func(ctx context.Context) error {
|
||||
return nil
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
awApp.MustRun()
|
||||
|
||||
<-awApp.Done()
|
||||
}
|
Reference in New Issue
Block a user