lncfg: make sure to only use native SQL with SQL backends
This commit is contained in:
1 file changed
+12
-1
+12
-1
@@ -122,13 +122,24 @@ func DefaultDB() *DB {
|
|||||||
// Validate validates the DB config.
|
// Validate validates the DB config.
|
||||||
func (db *DB) Validate() error {
|
func (db *DB) Validate() error {
|
||||||
switch db.Backend {
|
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:
|
case PostgresBackend:
|
||||||
if err := db.Postgres.Validate(); err != nil {
|
if err := db.Postgres.Validate(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case EtcdBackend:
|
case EtcdBackend:
|
||||||
|
if db.UseNativeSQL {
|
||||||
|
return fmt.Errorf("cannot use native SQL with etcd " +
|
||||||
|
"backend")
|
||||||
|
}
|
||||||
|
|
||||||
if !db.Etcd.Embedded && db.Etcd.Host == "" {
|
if !db.Etcd.Embedded && db.Etcd.Host == "" {
|
||||||
return fmt.Errorf("etcd host must be set")
|
return fmt.Errorf("etcd host must be set")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user