mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
config: Add norest config for disabling REST API
This commit adds a new config `norest` for disabling the REST API. This is useful in cases where it is not needed (i.e lnd running on mobile devices).
This commit is contained in:
parent
2cf10ada0f
commit
7c85363ef6
1 changed files with 12 additions and 5 deletions
17
config.go
17
config.go
|
@ -259,6 +259,7 @@ type config struct {
|
|||
Listeners []net.Addr
|
||||
ExternalIPs []net.Addr
|
||||
DisableListen bool `long:"nolisten" description:"Disable listening for incoming peer connections"`
|
||||
DisableRest bool `long:"norest" description:"Disable REST API"`
|
||||
NAT bool `long:"nat" description:"Toggle NAT traversal support (using either UPnP or NAT-PMP) to automatically advertise your external IP address to the network -- NOTE this does not support devices behind multiple NATs"`
|
||||
MinBackoff time.Duration `long:"minbackoff" description:"Shortest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."`
|
||||
MaxBackoff time.Duration `long:"maxbackoff" description:"Longest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."`
|
||||
|
@ -1031,11 +1032,17 @@ func loadConfig() (*config, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = lncfg.EnforceSafeAuthentication(
|
||||
cfg.RESTListeners, !cfg.NoMacaroons,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
if cfg.DisableRest {
|
||||
ltndLog.Infof("REST API is disabled!")
|
||||
cfg.RESTListeners = nil
|
||||
} else {
|
||||
err = lncfg.EnforceSafeAuthentication(
|
||||
cfg.RESTListeners, !cfg.NoMacaroons,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the listening addresses specified if listening is disabled.
|
||||
|
|
Loading…
Add table
Reference in a new issue