Melora Hugues
a4ca608937
All checks were successful
continuous-integration/drone/push Build is passing
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
43 lines
736 B
Go
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")
|
|
}
|