Files

32 lines
746 B
Go

package main
import (
"errors"
"log/slog"
"os"
"gitea.privcloud.tech/dizi/mtusi2026lab4/internal/bootstrap"
"gitea.privcloud.tech/dizi/mtusi2026lab4/internal/logger"
)
func main() {
appLogger := logger.New()
if err := run(appLogger, os.Args[1:]); err != nil {
appLogger.Error("application stopped", "error", err)
os.Exit(1)
}
}
func run(logger *slog.Logger, arguments []string) error {
if len(arguments) == 0 {
return bootstrap.RunServer(logger)
}
if len(arguments) == 1 && arguments[0] == "migrate" {
return bootstrap.RunMigrations()
}
if arguments[0] == "reconcile-attachments" {
return bootstrap.RunReconciliation(arguments[1:], os.Stdout)
}
return errors.New("usage: messenger [migrate|reconcile-attachments]")
}