Skip to content

Commit d974765

Browse files
committed
multi: add "disable" mode for all subservers
1 parent 7fc892d commit d974765

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

config.go

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ 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 a connection to 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 a connection to 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) 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. 'disable' means that LiT is started without a connection to pool." choice:"integrated" choice:"remote" choice:"disable"`
197197
Pool *pool.Config `group:"Integrated pool options (use when pool-mode=integrated)" namespace:"pool"`
198198

199199
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"`
@@ -460,20 +460,26 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) {
460460
// (like the log or lnd options) as they will be taken from lnd's config
461461
// struct. Others we want to force to be the same as lnd so the user
462462
// doesn't have to set them manually, like the network for example.
463-
cfg.Faraday.Lnd.MacaroonPath = faraday.DefaultLndMacaroonPath
464-
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
465-
return nil, err
463+
if cfg.FaradayMode != ModeDisable {
464+
cfg.Faraday.Lnd.MacaroonPath = faraday.DefaultLndMacaroonPath
465+
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
466+
return nil, err
467+
}
466468
}
467469

468470
defaultLoopCfg := loopd.DefaultConfig()
469-
cfg.Loop.Lnd.MacaroonPath = defaultLoopCfg.Lnd.MacaroonPath
470-
if err := loopd.Validate(cfg.Loop); err != nil {
471-
return nil, err
471+
if cfg.LoopMode != ModeDisable {
472+
cfg.Loop.Lnd.MacaroonPath = defaultLoopCfg.Lnd.MacaroonPath
473+
if err := loopd.Validate(cfg.Loop); err != nil {
474+
return nil, err
475+
}
472476
}
473477

474-
cfg.Pool.Lnd.MacaroonPath = pool.DefaultLndMacaroonPath
475-
if err := pool.Validate(cfg.Pool); err != nil {
476-
return nil, err
478+
if cfg.PoolMode != ModeDisable {
479+
cfg.Pool.Lnd.MacaroonPath = pool.DefaultLndMacaroonPath
480+
if err := pool.Validate(cfg.Pool); err != nil {
481+
return nil, err
482+
}
477483
}
478484

479485
if cfg.TaprootAssetsMode != ModeDisable {

terminal.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,18 +1409,24 @@ func (g *LightningTerminal) validateSuperMacaroon(ctx context.Context,
14091409
// initSubServers registers the faraday and loop sub-servers with the
14101410
// subServerMgr.
14111411
func (g *LightningTerminal) initSubServers() {
1412-
g.subServerMgr.AddServer(subservers.NewFaradaySubServer(
1413-
g.cfg.Faraday, g.cfg.faradayRpcConfig, g.cfg.Remote.Faraday,
1414-
g.cfg.faradayRemote,
1415-
))
1412+
if g.cfg.FaradayMode != ModeDisable {
1413+
g.subServerMgr.AddServer(subservers.NewFaradaySubServer(
1414+
g.cfg.Faraday, g.cfg.faradayRpcConfig,
1415+
g.cfg.Remote.Faraday, g.cfg.faradayRemote,
1416+
))
1417+
}
14161418

1417-
g.subServerMgr.AddServer(subservers.NewLoopSubServer(
1418-
g.cfg.Loop, g.cfg.Remote.Loop, g.cfg.loopRemote,
1419-
))
1419+
if g.cfg.LoopMode != ModeDisable {
1420+
g.subServerMgr.AddServer(subservers.NewLoopSubServer(
1421+
g.cfg.Loop, g.cfg.Remote.Loop, g.cfg.loopRemote,
1422+
))
1423+
}
14201424

1421-
g.subServerMgr.AddServer(subservers.NewPoolSubServer(
1422-
g.cfg.Pool, g.cfg.Remote.Pool, g.cfg.poolRemote,
1423-
))
1425+
if g.cfg.PoolMode != ModeDisable {
1426+
g.subServerMgr.AddServer(subservers.NewPoolSubServer(
1427+
g.cfg.Pool, g.cfg.Remote.Pool, g.cfg.poolRemote,
1428+
))
1429+
}
14241430

14251431
if g.cfg.TaprootAssetsMode != ModeDisable {
14261432
g.subServerMgr.AddServer(subservers.NewTaprootAssetsSubServer(

0 commit comments

Comments
 (0)