mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-07-03 03:12:30 +00:00
Gofmt latest dbtype config additions.
This commit is contained in:
parent
af7aa39624
commit
be3dc1837c
13
config.go
13
config.go
@ -7,10 +7,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
_ "github.com/conformal/btcdb/ldb"
|
||||||
|
_ "github.com/conformal/btcdb/sqlite3"
|
||||||
"github.com/conformal/btcwire"
|
"github.com/conformal/btcwire"
|
||||||
"github.com/conformal/go-flags"
|
"github.com/conformal/go-flags"
|
||||||
_ "github.com/conformal/btcdb/sqlite3"
|
|
||||||
_ "github.com/conformal/btcdb/ldb"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -306,11 +306,10 @@ func loadConfig() (*config, []string, error) {
|
|||||||
cfg.ConnectPeers =
|
cfg.ConnectPeers =
|
||||||
normalizeAndRemoveDuplicateAddresses(cfg.ConnectPeers)
|
normalizeAndRemoveDuplicateAddresses(cfg.ConnectPeers)
|
||||||
|
|
||||||
|
|
||||||
// determine which database backend to use
|
// determine which database backend to use
|
||||||
// would be interesting of btcdb had a 'supportedDBs() []string'
|
// would be interesting of btcdb had a 'supportedDBs() []string'
|
||||||
// API to populate this field.
|
// API to populate this field.
|
||||||
knownDbs := []string { "leveldb", "sqlite" }
|
knownDbs := []string{"leveldb", "sqlite"}
|
||||||
defaultDb := "sqlite"
|
defaultDb := "sqlite"
|
||||||
|
|
||||||
if len(cfg.DbType) == 0 {
|
if len(cfg.DbType) == 0 {
|
||||||
@ -323,10 +322,10 @@ func loadConfig() (*config, []string, error) {
|
|||||||
fi, err := os.Stat(dbPath)
|
fi, err := os.Stat(dbPath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
cfg.DbType = "leveldb"
|
cfg.DbType = "leveldb"
|
||||||
} else {
|
} else {
|
||||||
cfg.DbType = "sqlite"
|
cfg.DbType = "sqlite"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cfg.DbType = defaultDb
|
cfg.DbType = defaultDb
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user