package main import ( "flag" "log/slog" "os" "embed" "git.lastassault.de/speatzle/morffix/config" "git.lastassault.de/speatzle/morffix/server" "git.lastassault.de/speatzle/morffix/worker" "github.com/BurntSushi/toml" ) //go:embed tmpl var templates embed.FS //go:embed static var static embed.FS //go:embed migrations var migrations embed.FS var conf config.Config func main() { isServer := flag.Bool("server", false, "Run as Server") resetDB := flag.Bool("reset-db", false, "Reset DB") flag.Parse() confPath := "config.toml" _, err := os.Stat(confPath) if err != nil { confPath = "/etc/morffix/config.toml" } slog.Info("Loading Config", "path", confPath) _, err = toml.DecodeFile(confPath, &conf) if err != nil { slog.Error("Error Loading Config", "err", err) return } if conf.Worker.FFmpegPath == "" { conf.Worker.FFmpegPath = "ffmpeg" } if conf.Worker.TempDir == "" { conf.Worker.TempDir = "/tmp" } if *isServer { slog.Info("Starting Server...") server.Start(conf, templates, static, migrations, *resetDB) } else { slog.Info("Starting Worker...") worker.Start(conf) } }