mirror of
https://github.com/aljazceru/njump.git
synced 2026-02-09 16:14:23 +01:00
persistent KVStore on LMDB.
This commit is contained in:
1
main.go
1
main.go
@@ -24,6 +24,7 @@ type Settings struct {
|
||||
ServiceURL string `envconfig:"SERVICE_URL"`
|
||||
InternalDBPath string `envconfig:"DISK_CACHE_PATH" default:"/tmp/njump-internal"`
|
||||
EventStorePath string `envconfig:"EVENT_STORE_PATH" default:"/tmp/njump-db"`
|
||||
KVStorePath string `envconfig:"KV_STORE_PATH" default:"/tmp/njump-kv"`
|
||||
HintsMemoryDumpPath string `envconfig:"HINTS_SAVE_PATH" default:"/tmp/njump-hints.json"`
|
||||
TailwindDebug bool `envconfig:"TAILWIND_DEBUG"`
|
||||
RelayConfigPath string `envconfig:"RELAY_CONFIG_PATH"`
|
||||
|
||||
11
nostr.go
11
nostr.go
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/fiatjaf/eventstore/lmdb"
|
||||
"github.com/nbd-wtf/go-nostr"
|
||||
"github.com/nbd-wtf/go-nostr/sdk"
|
||||
lmdb_kv "github.com/nbd-wtf/go-nostr/sdk/kvstore/lmdb"
|
||||
)
|
||||
|
||||
type RelayConfig struct {
|
||||
@@ -48,10 +49,18 @@ func initSystem() func() {
|
||||
Path: s.EventStorePath,
|
||||
MaxLimit: DB_MAX_LIMIT,
|
||||
}
|
||||
db.Init()
|
||||
if err := db.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
kv, err := lmdb_kv.NewStore(s.EventStorePath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
sys = sdk.NewSystem(
|
||||
sdk.WithStore(db),
|
||||
sdk.WithKVStore(kv),
|
||||
)
|
||||
|
||||
return db.Close
|
||||
|
||||
Reference in New Issue
Block a user