Skip to content

Commit fb7f313

Browse files
committed
multi: add "disable" mode for all subservers
Just like for the Taproot Assets subserver, we add the option to disable the Loop, Pool and Faraday subservers.
1 parent b0931f4 commit fb7f313

File tree

2 files changed

+37
-25
lines changed

2 files changed

+37
-25
lines changed

config.go

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,16 @@ type Config struct {
187187
LndMode string `long:"lnd-mode" description:"The mode to run lnd in, either 'remote' (default) or 'integrated'. 'integrated' means lnd is started alongside the UI and everything is stored in lnd's main data directory, configure everything by using the --lnd.* flags. 'remote' means the UI connects to an existing lnd node and acts as a proxy for gRPC calls to it. In the remote node LiT creates its own directory for log and configuration files, configure everything using the --remote.* flags." choice:"integrated" choice:"remote"`
188188
Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"`
189189

190-
FaradayMode string `long:"faraday-mode" description:"The mode to run faraday in, either 'integrated' (default) or 'remote'. 'integrated' means faraday is started alongside the UI and everything is stored in faraday's main data directory, configure everything by using the --faraday.* flags. 'remote' means the UI connects to an existing faraday node and acts as a proxy for gRPC calls to it." choice:"integrated" choice:"remote"`
190+
FaradayMode string `long:"faraday-mode" description:"The mode to run faraday in, either 'integrated' (default), 'remote' or 'disable'. 'integrated' means faraday is started alongside the UI and everything is stored in faraday's main data directory, configure everything by using the --faraday.* flags. 'remote' means the UI connects to an existing faraday node and acts as a proxy for gRPC calls to it. 'disable' means that LiT is started without faraday." choice:"integrated" choice:"remote" choice:"disable"`
191191
Faraday *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"`
192192

193-
LoopMode string `long:"loop-mode" description:"The mode to run loop in, either 'integrated' (default) or 'remote'. 'integrated' means loopd is started alongside the UI and everything is stored in loop's main data directory, configure everything by using the --loop.* flags. 'remote' means the UI connects to an existing loopd node and acts as a proxy for gRPC calls to it." choice:"integrated" choice:"remote"`
193+
LoopMode string `long:"loop-mode" description:"The mode to run loop in, either 'integrated' (default), 'remote' or 'disable'. 'integrated' means loopd is started alongside the UI and everything is stored in loop's main data directory, configure everything by using the --loop.* flags. 'remote' means the UI connects to an existing loopd node and acts as a proxy for gRPC calls to it. 'disable' means that LiT is started without loop." choice:"integrated" choice:"remote" choice:"disable"`
194194
Loop *loopd.Config `group:"Integrated loop options (use when loop-mode=integrated)" namespace:"loop"`
195195

196-
PoolMode string `long:"pool-mode" description:"The mode to run pool in, either 'integrated' (default) or 'remote'. 'integrated' means poold is started alongside the UI and everything is stored in pool's main data directory, configure everything by using the --pool.* flags. 'remote' means the UI connects to an existing poold node and acts as a proxy for gRPC calls to it." choice:"integrated" choice:"remote"`
196+
PoolMode string `long:"pool-mode" description:"The mode to run pool in, either 'integrated' (default), 'remote' or 'disable'. 'integrated' means poold is started alongside the UI and everything is stored in pool's main data directory, configure everything by using the --pool.* flags. 'remote' means the UI connects to an existing poold node and acts as a proxy for gRPC calls to it. 'disable' means that LiT is started without pool." choice:"integrated" choice:"remote" choice:"disable"`
197197
Pool *pool.Config `group:"Integrated pool options (use when pool-mode=integrated)" namespace:"pool"`
198198

199-
TaprootAssetsMode string `long:"taproot-assets-mode" description:"The mode to run taproot assets in, either 'integrated' (default), 'remote' or 'disable'. 'integrated' means tapd is started alongside the UI and everything is stored in tap's main data directory, configure everything by using the --taproot-assets.* flags. 'remote' means the UI connects to an existing tapd node and acts as a proxy for gRPC calls to it. 'disable' means that LiT is started without a connection to tapd" choice:"integrated" choice:"disable"`
199+
TaprootAssetsMode string `long:"taproot-assets-mode" description:"The mode to run taproot assets in, either 'integrated' (default), 'remote' or 'disable'. 'integrated' means tapd is started alongside the UI and everything is stored in tap's main data directory, configure everything by using the --taproot-assets.* flags. 'remote' means the UI connects to an existing tapd node and acts as a proxy for gRPC calls to it. 'disable' means that LiT is started without tapd" choice:"integrated" choice:"disable"`
200200
TaprootAssets *tapcfg.Config `group:"Integrated taproot assets options (use when taproot-assets=integrated)" namespace:"taproot-assets"`
201201

202202
RPCMiddleware *mid.Config `group:"RPC middleware options" namespace:"rpcmiddleware"`
@@ -458,20 +458,26 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) {
458458
// (like the log or lnd options) as they will be taken from lnd's config
459459
// struct. Others we want to force to be the same as lnd so the user
460460
// doesn't have to set them manually, like the network for example.
461-
cfg.Faraday.Lnd.MacaroonPath = faraday.DefaultLndMacaroonPath
462-
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
463-
return nil, err
461+
if cfg.FaradayMode != ModeDisable {
462+
cfg.Faraday.Lnd.MacaroonPath = faraday.DefaultLndMacaroonPath
463+
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
464+
return nil, err
465+
}
464466
}
465467

466468
defaultLoopCfg := loopd.DefaultConfig()
467-
cfg.Loop.Lnd.MacaroonPath = defaultLoopCfg.Lnd.MacaroonPath
468-
if err := loopd.Validate(cfg.Loop); err != nil {
469-
return nil, err
469+
if cfg.LoopMode != ModeDisable {
470+
cfg.Loop.Lnd.MacaroonPath = defaultLoopCfg.Lnd.MacaroonPath
471+
if err := loopd.Validate(cfg.Loop); err != nil {
472+
return nil, err
473+
}
470474
}
471475

472-
cfg.Pool.Lnd.MacaroonPath = pool.DefaultLndMacaroonPath
473-
if err := pool.Validate(cfg.Pool); err != nil {
474-
return nil, err
476+
if cfg.PoolMode != ModeDisable {
477+
cfg.Pool.Lnd.MacaroonPath = pool.DefaultLndMacaroonPath
478+
if err := pool.Validate(cfg.Pool); err != nil {
479+
return nil, err
480+
}
475481
}
476482

477483
if cfg.TaprootAssetsMode != ModeDisable {

terminal.go

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,18 +1468,24 @@ func (g *LightningTerminal) validateSuperMacaroon(ctx context.Context,
14681468
// initSubServers registers the faraday and loop sub-servers with the
14691469
// subServerMgr.
14701470
func (g *LightningTerminal) initSubServers() {
1471-
g.subServerMgr.AddServer(subservers.NewFaradaySubServer(
1472-
g.cfg.Faraday, g.cfg.faradayRpcConfig, g.cfg.Remote.Faraday,
1473-
g.cfg.faradayRemote,
1474-
), true)
1475-
1476-
g.subServerMgr.AddServer(subservers.NewLoopSubServer(
1477-
g.cfg.Loop, g.cfg.Remote.Loop, g.cfg.loopRemote,
1478-
), true)
1479-
1480-
g.subServerMgr.AddServer(subservers.NewPoolSubServer(
1481-
g.cfg.Pool, g.cfg.Remote.Pool, g.cfg.poolRemote,
1482-
), true)
1471+
g.subServerMgr.AddServer(
1472+
subservers.NewFaradaySubServer(
1473+
g.cfg.Faraday, g.cfg.faradayRpcConfig,
1474+
g.cfg.Remote.Faraday, g.cfg.faradayRemote,
1475+
), g.cfg.FaradayMode != ModeDisable,
1476+
)
1477+
1478+
g.subServerMgr.AddServer(
1479+
subservers.NewLoopSubServer(
1480+
g.cfg.Loop, g.cfg.Remote.Loop, g.cfg.loopRemote,
1481+
), g.cfg.LoopMode != ModeDisable,
1482+
)
1483+
1484+
g.subServerMgr.AddServer(
1485+
subservers.NewPoolSubServer(
1486+
g.cfg.Pool, g.cfg.Remote.Pool, g.cfg.poolRemote,
1487+
), g.cfg.PoolMode != ModeDisable,
1488+
)
14831489

14841490
g.subServerMgr.AddServer(
14851491
subservers.NewTaprootAssetsSubServer(

0 commit comments

Comments
 (0)