Redmage/main.go

33 lines
572 B
Go
Raw Normal View History

2024-04-06 01:22:00 +07:00
package main
import (
"context"
"embed"
"errors"
"io/fs"
2024-04-06 01:22:00 +07:00
"os"
"github.com/joho/godotenv"
2024-04-06 01:22:00 +07:00
"github.com/tigorlazuardi/redmage/cli"
"github.com/tigorlazuardi/redmage/db"
2024-04-06 01:22:00 +07:00
)
2024-04-07 23:41:00 +07:00
//go:embed db/migrations/*.sql
var Migrations embed.FS
//go:embed public/*
var PublicFS embed.FS
2024-04-06 01:22:00 +07:00
func main() {
_ = godotenv.Load()
2024-04-07 23:41:00 +07:00
db.Migrations = Migrations
var err error
2024-04-09 14:30:54 +07:00
cli.PublicDir, err = fs.Sub(PublicFS, "public")
if err != nil {
panic(errors.New("failed to create sub filesystem"))
}
2024-04-06 01:22:00 +07:00
if err := cli.RootCmd.ExecuteContext(context.Background()); err != nil {
os.Exit(1)
}
}