@@ -8,11 +8,7 @@ import (
88 "path/filepath"
99
1010 "fiatjaf.com/nostr"
11- "fiatjaf.com/nostr/eventstore/lmdb"
12- "fiatjaf.com/nostr/eventstore/nullstore"
1311 "fiatjaf.com/nostr/sdk"
14- "fiatjaf.com/nostr/sdk/hints/lmdbh"
15- lmdbkv "fiatjaf.com/nostr/sdk/kvstore/lmdb"
1612 "github.com/fatih/color"
1713 "github.com/urfave/cli/v3"
1814)
@@ -103,31 +99,7 @@ var app = &cli.Command{
10399 Before : func (ctx context.Context , c * cli.Command ) (context.Context , error ) {
104100 sys = sdk .NewSystem ()
105101
106- configPath := c .String ("config-path" )
107- if configPath != "" {
108- hintsPath := filepath .Join (configPath , "outbox/hints" )
109- os .MkdirAll (hintsPath , 0755 )
110- _ , err := lmdbh .NewLMDBHints (hintsPath )
111- if err != nil {
112- log ("failed to create lmdb hints db at '%s': %s\n " , hintsPath , err )
113- }
114-
115- eventsPath := filepath .Join (configPath , "events" )
116- os .MkdirAll (eventsPath , 0755 )
117- sys .Store = & lmdb.LMDBBackend {Path : eventsPath }
118- if err := sys .Store .Init (); err != nil {
119- log ("failed to create boltdb events db at '%s': %s\n " , eventsPath , err )
120- sys .Store = & nullstore.NullStore {}
121- }
122-
123- kvPath := filepath .Join (configPath , "kvstore" )
124- os .MkdirAll (kvPath , 0755 )
125- if kv , err := lmdbkv .NewStore (kvPath ); err != nil {
126- log ("failed to create boltdb kvstore db at '%s': %s\n " , kvPath , err )
127- } else {
128- sys .KVStore = kv
129- }
130- }
102+ setupLocalDatabases (c , sys )
131103
132104 sys .Pool = nostr .NewPool (nostr.PoolOptions {
133105 AuthorKindQueryMiddleware : sys .TrackQueryAttempts ,
0 commit comments