This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"lostak.dev/shelly-exporter/application"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var configPath string
|
||||
flag.StringVar(&configPath, "config", "config.yaml", "Path to the YAML configuration file.")
|
||||
flag.Parse()
|
||||
|
||||
app, err := application.New(configPath)
|
||||
if err != nil {
|
||||
log.Fatalf("Cannot initialize Shelly exporter: %v", err)
|
||||
}
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
if err := app.Run(ctx); err != nil {
|
||||
log.Fatalf("Shelly exporter stopped unexpectedly: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user