butterrobot/cmd/butterrobot/main.go
Felipe M. ece8280358
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
feat: db migrations, encrypted passwords
2025-04-21 15:32:46 +02:00

46 lines
984 B
Go

package main
import (
"fmt"
"log/slog"
"os"
"runtime/debug"
"git.nakama.town/fmartingr/butterrobot/internal/app"
"git.nakama.town/fmartingr/butterrobot/internal/config"
)
func main() {
// Initialize logger
logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
// Load configuration
cfg, err := config.Load()
if err != nil {
logger.Error("Failed to load configuration", "error", err)
os.Exit(1)
}
// Handle version command
if len(os.Args) > 1 && os.Args[1] == "version" {
info, ok := debug.ReadBuildInfo()
if ok {
fmt.Printf("ButterRobot version %s\n", info.Main.Version)
} else {
fmt.Println("ButterRobot. Can't determine build information.")
}
return
}
// Initialize and run application
application, err := app.New(cfg, logger)
if err != nil {
logger.Error("Failed to initialize application", "error", err)
os.Exit(1)
}
if err := application.Run(); err != nil {
logger.Error("Application error", "error", err)
os.Exit(1)
}
}