mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-14 20:08:02 +00:00
54 lines
914 B
Go
54 lines
914 B
Go
|
package integration
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
_ "embed"
|
||
|
"os/exec"
|
||
|
"path/filepath"
|
||
|
|
||
|
"github.com/zitadel/logging"
|
||
|
"sigs.k8s.io/yaml"
|
||
|
)
|
||
|
|
||
|
type Config struct {
|
||
|
Log *logging.Config
|
||
|
Hostname string
|
||
|
Port uint16
|
||
|
Secure bool
|
||
|
LoginURLV2 string
|
||
|
LogoutURLV2 string
|
||
|
WebAuthNName string
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
//go:embed config/client.yaml
|
||
|
clientYAML []byte
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
tmpDir string
|
||
|
loadedConfig Config
|
||
|
)
|
||
|
|
||
|
// TmpDir returns the absolute path to the projects's temp directory.
|
||
|
func TmpDir() string {
|
||
|
return tmpDir
|
||
|
}
|
||
|
|
||
|
func init() {
|
||
|
cmd := exec.Command("git", "rev-parse", "--show-toplevel")
|
||
|
out, err := cmd.Output()
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
tmpDir = filepath.Join(string(bytes.TrimSpace(out)), "tmp")
|
||
|
|
||
|
if err := yaml.Unmarshal(clientYAML, &loadedConfig); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
if err := loadedConfig.Log.SetLogger(); err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
SystemToken = systemUserToken()
|
||
|
}
|