mirror of
https://github.com/aljazceru/wot-relay.git
synced 2025-12-17 14:24:28 +01:00
use tags to select abdger db
This commit is contained in:
14
db_badger.go
Normal file
14
db_badger.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// +build badger
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/fiatjaf/eventstore/badger"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getDB() badger.BadgerBackend {
|
||||||
|
return badger.BadgerBackend{
|
||||||
|
Path: getEnv("DB_PATH"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
14
db_default.go
Normal file
14
db_default.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// +build !badger
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/fiatjaf/eventstore/lmdb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getDB() lmdb.LMDBBackend {
|
||||||
|
return lmdb.LMDBBackend{
|
||||||
|
Path: getEnv("DB_PATH"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
5
main.go
5
main.go
@@ -11,7 +11,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cespare/xxhash"
|
"github.com/cespare/xxhash"
|
||||||
"github.com/fiatjaf/eventstore/lmdb"
|
|
||||||
"github.com/fiatjaf/khatru"
|
"github.com/fiatjaf/khatru"
|
||||||
"github.com/greatroar/blobloom"
|
"github.com/greatroar/blobloom"
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
@@ -62,9 +61,7 @@ func main() {
|
|||||||
relay.Info.Description = config.RelayDescription
|
relay.Info.Description = config.RelayDescription
|
||||||
appendPubkey(config.RelayPubkey)
|
appendPubkey(config.RelayPubkey)
|
||||||
|
|
||||||
db := lmdb.LMDBBackend{
|
db := getDB()
|
||||||
Path: config.DBPath,
|
|
||||||
}
|
|
||||||
if err := db.Init(); err != nil {
|
if err := db.Init(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user