supabase-operator/magefiles/common.go
Peter Kurfer 12090c913a
Some checks failed
E2E Tests / Run on Ubuntu (push) Failing after 20s
Lint / Run on Ubuntu (push) Failing after 3m45s
Tests / Run on Ubuntu (push) Failing after 16m8s
feat(db): prepare migrations and core CRD
2024-12-13 09:09:14 +01:00

39 lines
653 B
Go

package main
import (
"embed"
"log/slog"
"os"
"text/template"
_ "github.com/magefile/mage/sh"
)
var (
workingDir string
//go:embed templates/*.tmpl
templatesFS embed.FS
templates *template.Template
)
func init() {
logLevel := new(slog.LevelVar)
if val, set := os.LookupEnv("MAGE_LOG_LEVEL"); set {
_ = logLevel.UnmarshalText([]byte(val))
}
handler := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
Level: logLevel,
})
slog.SetDefault(slog.New(handler))
if wd, err := os.Getwd(); err != nil {
panic(err)
} else {
workingDir = wd
}
templates = template.Must(template.ParseFS(templatesFS, "templates/*.tmpl"))
}