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.
This commit is contained in:
Elle Mouton 2023-05-21 12:43:52 +02:00
parent b0931f49b0
commit fb7f313c80
No known key found for this signature in database
GPG key ID: D7D916376026F177
2 changed files with 35 additions and 23 deletions

View file

@ -187,16 +187,16 @@ type Config struct {
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"`
Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"`
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"`
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"`
Faraday *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"`
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"`
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"`
Loop *loopd.Config `group:"Integrated loop options (use when loop-mode=integrated)" namespace:"loop"`
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"`
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"`
Pool *pool.Config `group:"Integrated pool options (use when pool-mode=integrated)" namespace:"pool"`
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"`
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"`
TaprootAssets *tapcfg.Config `group:"Integrated taproot assets options (use when taproot-assets=integrated)" namespace:"taproot-assets"`
RPCMiddleware *mid.Config `group:"RPC middleware options" namespace:"rpcmiddleware"`
@ -458,20 +458,26 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) {
// (like the log or lnd options) as they will be taken from lnd's config
// struct. Others we want to force to be the same as lnd so the user
// doesn't have to set them manually, like the network for example.
cfg.Faraday.Lnd.MacaroonPath = faraday.DefaultLndMacaroonPath
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
return nil, err
if cfg.FaradayMode != ModeDisable {
cfg.Faraday.Lnd.MacaroonPath = faraday.DefaultLndMacaroonPath
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
return nil, err
}
}
defaultLoopCfg := loopd.DefaultConfig()
cfg.Loop.Lnd.MacaroonPath = defaultLoopCfg.Lnd.MacaroonPath
if err := loopd.Validate(cfg.Loop); err != nil {
return nil, err
if cfg.LoopMode != ModeDisable {
cfg.Loop.Lnd.MacaroonPath = defaultLoopCfg.Lnd.MacaroonPath
if err := loopd.Validate(cfg.Loop); err != nil {
return nil, err
}
}
cfg.Pool.Lnd.MacaroonPath = pool.DefaultLndMacaroonPath
if err := pool.Validate(cfg.Pool); err != nil {
return nil, err
if cfg.PoolMode != ModeDisable {
cfg.Pool.Lnd.MacaroonPath = pool.DefaultLndMacaroonPath
if err := pool.Validate(cfg.Pool); err != nil {
return nil, err
}
}
if cfg.TaprootAssetsMode != ModeDisable {

View file

@ -1468,18 +1468,24 @@ func (g *LightningTerminal) validateSuperMacaroon(ctx context.Context,
// initSubServers registers the faraday and loop sub-servers with the
// subServerMgr.
func (g *LightningTerminal) initSubServers() {
g.subServerMgr.AddServer(subservers.NewFaradaySubServer(
g.cfg.Faraday, g.cfg.faradayRpcConfig, g.cfg.Remote.Faraday,
g.cfg.faradayRemote,
), true)
g.subServerMgr.AddServer(
subservers.NewFaradaySubServer(
g.cfg.Faraday, g.cfg.faradayRpcConfig,
g.cfg.Remote.Faraday, g.cfg.faradayRemote,
), g.cfg.FaradayMode != ModeDisable,
)
g.subServerMgr.AddServer(subservers.NewLoopSubServer(
g.cfg.Loop, g.cfg.Remote.Loop, g.cfg.loopRemote,
), true)
g.subServerMgr.AddServer(
subservers.NewLoopSubServer(
g.cfg.Loop, g.cfg.Remote.Loop, g.cfg.loopRemote,
), g.cfg.LoopMode != ModeDisable,
)
g.subServerMgr.AddServer(subservers.NewPoolSubServer(
g.cfg.Pool, g.cfg.Remote.Pool, g.cfg.poolRemote,
), true)
g.subServerMgr.AddServer(
subservers.NewPoolSubServer(
g.cfg.Pool, g.cfg.Remote.Pool, g.cfg.poolRemote,
), g.cfg.PoolMode != ModeDisable,
)
g.subServerMgr.AddServer(
subservers.NewTaprootAssetsSubServer(