mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
lncfg: add configuration for user specified db backend
This commit extends lncfg to support user specified database backend. This supports configuration for both bolt and etcd (while only allowing one or the other).
This commit is contained in:
12
config.go
12
config.go
@@ -248,6 +248,8 @@ type Config struct {
|
||||
|
||||
AllowCircularRoute bool `long:"allow-circular-route" description:"If true, our node will allow htlc forwards that arrive and depart on the same channel."`
|
||||
|
||||
DB *lncfg.DB `group:"db" namespace:"db"`
|
||||
|
||||
// registeredChains keeps track of all chains that have been registered
|
||||
// with the daemon.
|
||||
registeredChains *chainRegistry
|
||||
@@ -358,6 +360,7 @@ func DefaultConfig() Config {
|
||||
},
|
||||
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
|
||||
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,
|
||||
DB: lncfg.DefaultDB(),
|
||||
registeredChains: newChainRegistry(),
|
||||
}
|
||||
}
|
||||
@@ -1073,6 +1076,7 @@ func ValidateConfig(cfg Config, usageMessage string) (*Config, error) {
|
||||
cfg.Workers,
|
||||
cfg.Caches,
|
||||
cfg.WtClient,
|
||||
cfg.DB,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1090,6 +1094,14 @@ func ValidateConfig(cfg Config, usageMessage string) (*Config, error) {
|
||||
return &cfg, err
|
||||
}
|
||||
|
||||
// localDatabaseDir returns the default directory where the
|
||||
// local bolt db files are stored.
|
||||
func (c *config) localDatabaseDir() string {
|
||||
return filepath.Join(cfg.DataDir,
|
||||
defaultGraphSubDirname,
|
||||
normalizeNetwork(activeNetParams.Name))
|
||||
}
|
||||
|
||||
// CleanAndExpandPath expands environment variables and leading ~ in the
|
||||
// passed path, cleans the result, and returns it.
|
||||
// This function is taken from https://github.com/btcsuite/btcd
|
||||
|
Reference in New Issue
Block a user