start: add config struct for db path
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
786e0f03f8
commit
568098af1d
3 changed files with 12 additions and 3 deletions
|
|
@ -4,8 +4,8 @@ import (
|
|||
"github.com/dgraph-io/badger/v4"
|
||||
)
|
||||
|
||||
func InitDB() *badger.DB {
|
||||
opts := badger.DefaultOptions("./data")
|
||||
func InitDB(conf Config) *badger.DB {
|
||||
opts := badger.DefaultOptions(conf.Path)
|
||||
opts.Logger = nil
|
||||
opts.ValueLogFileSize = 10 << 20 // 10 Mo par fichier vlog
|
||||
opts.NumMemtables = 1
|
||||
|
|
|
|||
5
pkg/db/kv/struct.go
Normal file
5
pkg/db/kv/struct.go
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package kv
|
||||
|
||||
type Config struct {
|
||||
Path string
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue