sarafu-vise/testutil/setup.go

33 lines
794 B
Go
Raw Normal View History

2025-01-20 11:28:42 +01:00
package testutil
import (
"context"
"path"
"git.defalsify.org/vise.git/db"
2025-01-21 16:43:26 +01:00
fsdb "git.defalsify.org/vise.git/db/fs"
"git.defalsify.org/vise.git/logging"
2025-01-20 11:28:42 +01:00
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
2025-01-21 16:43:26 +01:00
"git.grassecon.net/grassrootseconomics/visedriver/storage"
testdataloader "github.com/peteole/testdata-loader"
2025-01-20 11:28:42 +01:00
)
var (
2025-01-21 16:43:26 +01:00
logg = logging.NewVanilla().WithDomain("sarafu-vise.testutil").WithContextKey("SessionId")
conns storage.Conns
2025-01-20 11:28:42 +01:00
resourceDb db.Db
2025-01-21 16:43:26 +01:00
baseDir = testdataloader.GetBasePath()
scriptDir = path.Join(baseDir, "services", "registration")
override config.Override
2025-01-20 11:28:42 +01:00
)
func init() {
ctx := context.Background()
config.EnvPath = baseDir
resourceDb = fsdb.NewFsDb()
err := resourceDb.Connect(ctx, scriptDir)
if err != nil {
panic(err)
}
}