add config system
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
c2d1b18c98
commit
badd6517a5
3 changed files with 50 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"git.g3e.fr/syonad/two/internal/config"
|
||||
"git.g3e.fr/syonad/two/pkg/db/kv"
|
||||
"github.com/dgraph-io/badger/v4"
|
||||
)
|
||||
|
|
@ -124,11 +125,15 @@ func printDB() {
|
|||
}
|
||||
|
||||
func main() {
|
||||
var conf kv.Config = kv.Config{
|
||||
Path: "./data/",
|
||||
configuration, err := config.LoadConfig("./two.yaml")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
DB = kv.InitDB(conf)
|
||||
DB = kv.InitDB(kv.Config{
|
||||
Path: configuration.Database.Path,
|
||||
})
|
||||
defer DB.Close()
|
||||
|
||||
printDB()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue