first compiling version

This commit is contained in:
ston1th 2023-03-15 01:51:45 +01:00
commit 3d54199faa
27 changed files with 908 additions and 243 deletions

View file

@ -7,7 +7,6 @@ import (
"path/filepath"
"git.giftfish.de/ston1th/godrop/v2"
"git.giftfish.de/ston1th/keyctl/pkg/core"
"git.giftfish.de/ston1th/keyctl/pkg/store"
"github.com/go-logr/logr"
)
@ -19,9 +18,9 @@ type DB struct {
store store.Store
}
func NewPlain(log logr.Logger, cfg *core.Config) (db *DB, err error) {
func NewPlain(log logr.Logger, dir string) (db *DB, err error) {
db = &DB{log: log}
dbFile := filepath.Join(cfg.DataDir, storeFile)
dbFile := filepath.Join(dir, storeFile)
err = godrop.Unveil(dbFile, "rwc")
if err != nil {
return
@ -30,8 +29,8 @@ func NewPlain(log logr.Logger, cfg *core.Config) (db *DB, err error) {
return
}
func New(log logr.Logger, cfg *core.Config) (db *DB, err error) {
db, err = NewPlain(log, cfg)
func New(log logr.Logger, dir string) (db *DB, err error) {
db, err = NewPlain(log, dir)
if err != nil {
return
}