mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-02 17:52:28 +02:00
config: expose watchtower conf
This commit is contained in:
17
config.go
17
config.go
@@ -40,6 +40,7 @@ const (
|
|||||||
defaultDataDirname = "data"
|
defaultDataDirname = "data"
|
||||||
defaultChainSubDirname = "chain"
|
defaultChainSubDirname = "chain"
|
||||||
defaultGraphSubDirname = "graph"
|
defaultGraphSubDirname = "graph"
|
||||||
|
defaultTowerSubDirname = "watchtower"
|
||||||
defaultTLSCertFilename = "tls.cert"
|
defaultTLSCertFilename = "tls.cert"
|
||||||
defaultTLSKeyFilename = "tls.key"
|
defaultTLSKeyFilename = "tls.key"
|
||||||
defaultAdminMacFilename = "admin.macaroon"
|
defaultAdminMacFilename = "admin.macaroon"
|
||||||
@@ -133,6 +134,8 @@ var (
|
|||||||
defaultDataDir = filepath.Join(defaultLndDir, defaultDataDirname)
|
defaultDataDir = filepath.Join(defaultLndDir, defaultDataDirname)
|
||||||
defaultLogDir = filepath.Join(defaultLndDir, defaultLogDirname)
|
defaultLogDir = filepath.Join(defaultLndDir, defaultLogDirname)
|
||||||
|
|
||||||
|
defaultTowerDir = filepath.Join(defaultDataDir, defaultTowerSubDirname)
|
||||||
|
|
||||||
defaultTLSCertPath = filepath.Join(defaultLndDir, defaultTLSCertFilename)
|
defaultTLSCertPath = filepath.Join(defaultLndDir, defaultTLSCertFilename)
|
||||||
defaultTLSKeyPath = filepath.Join(defaultLndDir, defaultTLSKeyFilename)
|
defaultTLSKeyPath = filepath.Join(defaultLndDir, defaultTLSKeyFilename)
|
||||||
|
|
||||||
@@ -318,6 +321,8 @@ type config struct {
|
|||||||
Prometheus lncfg.Prometheus `group:"prometheus" namespace:"prometheus"`
|
Prometheus lncfg.Prometheus `group:"prometheus" namespace:"prometheus"`
|
||||||
|
|
||||||
WtClient *lncfg.WtClient `group:"wtclient" namespace:"wtclient"`
|
WtClient *lncfg.WtClient `group:"wtclient" namespace:"wtclient"`
|
||||||
|
|
||||||
|
Watchtower *lncfg.Watchtower `group:"watchtower" namespace:"watchtower"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadConfig initializes and parses the config using a config file and command
|
// loadConfig initializes and parses the config using a config file and command
|
||||||
@@ -413,6 +418,9 @@ func loadConfig() (*config, error) {
|
|||||||
ChannelCacheSize: channeldb.DefaultChannelCacheSize,
|
ChannelCacheSize: channeldb.DefaultChannelCacheSize,
|
||||||
},
|
},
|
||||||
Prometheus: lncfg.DefaultPrometheus(),
|
Prometheus: lncfg.DefaultPrometheus(),
|
||||||
|
Watchtower: &lncfg.Watchtower{
|
||||||
|
TowerDir: defaultTowerDir,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre-parse the command line options to pick up an alternative config
|
// Pre-parse the command line options to pick up an alternative config
|
||||||
@@ -473,6 +481,14 @@ func loadConfig() (*config, error) {
|
|||||||
cfg.TLSCertPath = filepath.Join(lndDir, defaultTLSCertFilename)
|
cfg.TLSCertPath = filepath.Join(lndDir, defaultTLSCertFilename)
|
||||||
cfg.TLSKeyPath = filepath.Join(lndDir, defaultTLSKeyFilename)
|
cfg.TLSKeyPath = filepath.Join(lndDir, defaultTLSKeyFilename)
|
||||||
cfg.LogDir = filepath.Join(lndDir, defaultLogDirname)
|
cfg.LogDir = filepath.Join(lndDir, defaultLogDirname)
|
||||||
|
|
||||||
|
// If the watchtower's directory is set to the default, i.e. the
|
||||||
|
// user has not requested a different location, we'll move the
|
||||||
|
// location to be relative to the specified lnd directory.
|
||||||
|
if cfg.Watchtower.TowerDir == defaultTowerDir {
|
||||||
|
cfg.Watchtower.TowerDir =
|
||||||
|
filepath.Join(cfg.DataDir, defaultTowerSubDirname)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the lnd directory if it doesn't already exist.
|
// Create the lnd directory if it doesn't already exist.
|
||||||
@@ -509,6 +525,7 @@ func loadConfig() (*config, error) {
|
|||||||
cfg.BitcoindMode.Dir = cleanAndExpandPath(cfg.BitcoindMode.Dir)
|
cfg.BitcoindMode.Dir = cleanAndExpandPath(cfg.BitcoindMode.Dir)
|
||||||
cfg.LitecoindMode.Dir = cleanAndExpandPath(cfg.LitecoindMode.Dir)
|
cfg.LitecoindMode.Dir = cleanAndExpandPath(cfg.LitecoindMode.Dir)
|
||||||
cfg.Tor.PrivateKeyPath = cleanAndExpandPath(cfg.Tor.PrivateKeyPath)
|
cfg.Tor.PrivateKeyPath = cleanAndExpandPath(cfg.Tor.PrivateKeyPath)
|
||||||
|
cfg.Watchtower.TowerDir = cleanAndExpandPath(cfg.Watchtower.TowerDir)
|
||||||
|
|
||||||
// Ensure that the user didn't attempt to specify negative values for
|
// Ensure that the user didn't attempt to specify negative values for
|
||||||
// any of the autopilot params.
|
// any of the autopilot params.
|
||||||
|
Reference in New Issue
Block a user