lncfg+channeldb: add config to be able to run lnd on embedded etcd
This commit is contained in:
parent
17976df658
commit
511e817624
@ -30,6 +30,8 @@ type BoltConfig struct {
|
|||||||
|
|
||||||
// EtcdConfig holds etcd configuration.
|
// EtcdConfig holds etcd configuration.
|
||||||
type EtcdConfig struct {
|
type EtcdConfig struct {
|
||||||
|
Embedded bool `long:"embedded" description:"Use embedded etcd instance instead of the external one."`
|
||||||
|
|
||||||
Host string `long:"host" description:"Etcd database host."`
|
Host string `long:"host" description:"Etcd database host."`
|
||||||
|
|
||||||
User string `long:"user" description:"Etcd database user."`
|
User string `long:"user" description:"Etcd database user."`
|
||||||
|
10
lncfg/db.go
10
lncfg/db.go
@ -38,7 +38,7 @@ func (db *DB) Validate() error {
|
|||||||
case BoltBackend:
|
case BoltBackend:
|
||||||
|
|
||||||
case EtcdBackend:
|
case EtcdBackend:
|
||||||
if 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")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,12 @@ func (db *DB) GetBackends(ctx context.Context, dbPath string,
|
|||||||
)
|
)
|
||||||
|
|
||||||
if db.Backend == EtcdBackend {
|
if db.Backend == EtcdBackend {
|
||||||
// Prefix will separate key/values in the db.
|
if db.Etcd.Embedded {
|
||||||
remoteDB, err = kvdb.GetEtcdBackend(ctx, networkName, db.Etcd)
|
remoteDB, _, err = kvdb.GetEtcdTestBackend(dbPath, dbName)
|
||||||
|
} else {
|
||||||
|
// Prefix will separate key/values in the db.
|
||||||
|
remoteDB, err = kvdb.GetEtcdBackend(ctx, networkName, db.Etcd)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user