Skip to content

Commit fb31234

Browse files
committed
Add db_path to config
1 parent 3659fb9 commit fb31234

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

cmd/mpcium/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,13 @@ func GetIDFromName(name string, peers []config.Peer) string {
332332

333333
func NewBadgerKV(nodeName string) *kvstore.BadgerKVStore {
334334
// Badger KV DB
335-
dbPath := filepath.Join(".", "db", nodeName)
335+
// Use configured db_path or default to current directory + "db"
336+
basePath := viper.GetString("db_path")
337+
if basePath == "" {
338+
basePath = filepath.Join(".", "db")
339+
}
340+
dbPath := filepath.Join(basePath, nodeName)
341+
336342
badgerKv, err := kvstore.NewBadgerKVStore(
337343
dbPath,
338344
[]byte(viper.GetString("badger_password")),

config.yaml.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ environment: development
88
badger_password: "your_badger_password"
99
event_initiator_pubkey: "event_initiator_pubkey"
1010
max_concurrent_keygen: 2
11+
db_path: "."

0 commit comments

Comments
 (0)