public-ip-tracker/tracker/main.go
Melora Hugues a4ca608937
All checks were successful
continuous-integration/drone/push Build is passing
Remove previous test methods
There were a few tests that used to be here only to run a mock pipeline.
Since we now have testable methods, this is not useful anymore and this
commit removes them
2023-01-27 18:01:37 +01:00

43 lines
736 B
Go

package main
import (
"context"
"flag"
"fmt"
"git.faercol.me/faercol/public-ip-tracker/tracker/bot"
"git.faercol.me/faercol/public-ip-tracker/tracker/config"
)
type cliArgs struct {
configPath string
}
func parseArgs() *cliArgs {
configPath := flag.String("config", "", "Path to the JSON configuration file")
flag.Parse()
return &cliArgs{
configPath: *configPath,
}
}
func main() {
fmt.Println("Parsing arguments")
args := parseArgs()
fmt.Println("Parsing config")
conf, err := config.New(args.configPath)
if err != nil {
panic(err)
}
fmt.Println("Initializing bot")
notifBot := bot.New(context.Background(), conf)
if err := notifBot.SendInitMessage(); err != nil {
panic(err)
}
fmt.Println("OK")
}