Use Charm data path for Badger

This commit is contained in:
Toby Padilla 2021-06-16 18:30:42 -05:00 committed by Christian Rocha
commit 5d70ef4976
No known key found for this signature in database
GPG key ID: D6CC7A16E5878018

View file

@ -9,6 +9,7 @@ import (
"sort"
"time"
"github.com/charmbracelet/charm/client"
"github.com/charmbracelet/charm/kv"
"github.com/dgraph-io/badger/v3"
"github.com/google/uuid"
@ -46,7 +47,11 @@ type Markdown struct {
// NewClient creates a new Client with the default settings
func NewClient() (*Client, error) {
kv, err := kv.OpenWithDefaults("charm.sh.glow", "./data")
dp, err := client.DataPath()
if err != nil {
return nil, err
}
kv, err := kv.OpenWithDefaults("charm.sh.glow", fmt.Sprintf("%s/kv", dp))
if err != nil {
return nil, err
}