diff --git a/config.go b/config.go index d3d28a2b3..50a6fffa4 100644 --- a/config.go +++ b/config.go @@ -638,9 +638,7 @@ func DefaultConfig() Config { ChannelCacheSize: channeldb.DefaultChannelCacheSize, }, Prometheus: lncfg.DefaultPrometheus(), - Watchtower: &lncfg.Watchtower{ - TowerDir: defaultTowerDir, - }, + Watchtower: lncfg.DefaultWatchtowerCfg(defaultTowerDir), HealthChecks: &lncfg.HealthCheckConfig{ ChainCheck: &lncfg.CheckConfig{ Interval: defaultChainInterval, diff --git a/lncfg/watchtower.go b/lncfg/watchtower.go index 4ef2919a2..851d24e92 100644 --- a/lncfg/watchtower.go +++ b/lncfg/watchtower.go @@ -13,3 +13,14 @@ type Watchtower struct { watchtower.Conf } + +// DefaultWatchtowerCfg creates a Watchtower with some default values filled +// out. +func DefaultWatchtowerCfg(defaultTowerDir string) *Watchtower { + conf := watchtower.DefaultConf() + + return &Watchtower{ + TowerDir: defaultTowerDir, + Conf: *conf, + } +} diff --git a/watchtower/conf.go b/watchtower/conf.go index 653ed1e85..9b81a1447 100644 --- a/watchtower/conf.go +++ b/watchtower/conf.go @@ -23,6 +23,14 @@ type Conf struct { WriteTimeout time.Duration `long:"writetimeout" description:"Duration the watchtower server will wait for messages to be written before hanging up on client connections"` } +// DefaultConf returns a Conf with some default values filled in. +func DefaultConf() *Conf { + return &Conf{ + ReadTimeout: DefaultReadTimeout, + WriteTimeout: DefaultWriteTimeout, + } +} + // Apply completes the passed Config struct by applying any parsed Conf options. // If the corresponding values parsed by Conf are already set in the Config, // those fields will be not be modified.