mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
lncfg: make sure to only use native SQL with SQL backends
This commit is contained in:
parent
b0552da007
commit
65c1f5483b
13
lncfg/db.go
13
lncfg/db.go
@ -122,13 +122,24 @@ func DefaultDB() *DB {
|
||||
// Validate validates the DB config.
|
||||
func (db *DB) Validate() error {
|
||||
switch db.Backend {
|
||||
case BoltBackend, SqliteBackend:
|
||||
case BoltBackend:
|
||||
if db.UseNativeSQL {
|
||||
return fmt.Errorf("cannot use native SQL with bolt " +
|
||||
"backend")
|
||||
}
|
||||
|
||||
case SqliteBackend:
|
||||
case PostgresBackend:
|
||||
if err := db.Postgres.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case EtcdBackend:
|
||||
if db.UseNativeSQL {
|
||||
return fmt.Errorf("cannot use native SQL with etcd " +
|
||||
"backend")
|
||||
}
|
||||
|
||||
if !db.Etcd.Embedded && db.Etcd.Host == "" {
|
||||
return fmt.Errorf("etcd host must be set")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user