supabase-operator/magefiles/common.go
Peter Kurfer 604525de38
Some checks failed
Docs / deploy (push) Successful in 53s
Lint / Run on Ubuntu (push) Failing after 3m49s
E2E Tests / Run on Ubuntu (push) Failing after 28s
Tests / Run on Ubuntu (push) Failing after 3m38s
release / release (push) Successful in 9m13s
feat: prepare test execution with mage & update tools
2025-01-22 19:15:26 +01:00

59 lines
1.2 KiB
Go

/*
Copyright 2025 Peter Kurfer.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
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
)
const (
k8sVersion = "1.31.0"
)
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"))
}