Merge pull request #3467 from hsjoberg/norest-config
config: Add norest config for disabling REST API
This commit is contained in:
commit
e61ec3a46d
@ -259,6 +259,7 @@ type config struct {
|
|||||||
Listeners []net.Addr
|
Listeners []net.Addr
|
||||||
ExternalIPs []net.Addr
|
ExternalIPs []net.Addr
|
||||||
DisableListen bool `long:"nolisten" description:"Disable listening for incoming peer connections"`
|
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"`
|
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}."`
|
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}."`
|
MaxBackoff time.Duration `long:"maxbackoff" description:"Longest backoff when reconnecting to persistent peers. Valid time units are {s, m, h}."`
|
||||||
@ -1031,12 +1032,18 @@ func loadConfig() (*config, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.DisableRest {
|
||||||
|
ltndLog.Infof("REST API is disabled!")
|
||||||
|
cfg.RESTListeners = nil
|
||||||
|
} else {
|
||||||
err = lncfg.EnforceSafeAuthentication(
|
err = lncfg.EnforceSafeAuthentication(
|
||||||
cfg.RESTListeners, !cfg.NoMacaroons,
|
cfg.RESTListeners, !cfg.NoMacaroons,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove the listening addresses specified if listening is disabled.
|
// Remove the listening addresses specified if listening is disabled.
|
||||||
if cfg.DisableListen {
|
if cfg.DisableListen {
|
||||||
|
@ -3,6 +3,7 @@ debuglevel=info
|
|||||||
no-macaroons=1
|
no-macaroons=1
|
||||||
maxbackoff=2s
|
maxbackoff=2s
|
||||||
nolisten=1
|
nolisten=1
|
||||||
|
norest=1
|
||||||
|
|
||||||
[Routing]
|
[Routing]
|
||||||
routing.assumechanvalid=1
|
routing.assumechanvalid=1
|
||||||
|
Loading…
Reference in New Issue
Block a user