mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
config: remove gRPC related configs
This commit is contained in:
parent
1917978ae8
commit
08e57e9ee3
1 changed files with 2 additions and 40 deletions
42
config.go
42
config.go
|
@ -103,12 +103,6 @@ type config struct {
|
||||||
Username string `short:"u" long:"username" description:"Username for legacy RPC and lbcd authentication (if lbcdusername is unset)"`
|
Username string `short:"u" long:"username" description:"Username for legacy RPC and lbcd authentication (if lbcdusername is unset)"`
|
||||||
Password string `short:"P" long:"password" default-mask:"-" description:"Password for legacy RPC and lbcd authentication (if lbcdpassword is unset)"`
|
Password string `short:"P" long:"password" default-mask:"-" description:"Password for legacy RPC and lbcd authentication (if lbcdpassword is unset)"`
|
||||||
|
|
||||||
// EXPERIMENTAL RPC server options
|
|
||||||
//
|
|
||||||
// These options will change (and require changes to config files, etc.)
|
|
||||||
// when the new gRPC server is enabled.
|
|
||||||
ExperimentalRPCListeners []string `long:"experimentalrpclisten" description:"Listen for RPC connections on this interface/port"`
|
|
||||||
|
|
||||||
// Deprecated options
|
// Deprecated options
|
||||||
DataDir *cfgutil.ExplicitString `short:"b" long:"datadir" default-mask:"-" description:"DEPRECATED -- use appdata instead"`
|
DataDir *cfgutil.ExplicitString `short:"b" long:"datadir" default-mask:"-" description:"DEPRECATED -- use appdata instead"`
|
||||||
}
|
}
|
||||||
|
@ -578,12 +572,7 @@ func loadConfig() (*config, []string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only set default RPC listeners when there are no listeners set for
|
if len(cfg.LegacyRPCListeners) == 0 {
|
||||||
// the experimental RPC server. This is required to prevent the old RPC
|
|
||||||
// server from sharing listen addresses, since it is impossible to
|
|
||||||
// remove defaults from go-flags slice options without assigning
|
|
||||||
// specific behavior to a particular string.
|
|
||||||
if len(cfg.ExperimentalRPCListeners) == 0 && len(cfg.LegacyRPCListeners) == 0 {
|
|
||||||
addrs, err := net.LookupHost("localhost")
|
addrs, err := net.LookupHost("localhost")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -604,36 +593,9 @@ func loadConfig() (*config, []string, error) {
|
||||||
"Invalid network address in legacy RPC listeners: %v\n", err)
|
"Invalid network address in legacy RPC listeners: %v\n", err)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
cfg.ExperimentalRPCListeners, err = cfgutil.NormalizeAddresses(
|
|
||||||
cfg.ExperimentalRPCListeners, activeNet.RPCServerPort)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Fprintf(os.Stderr,
|
|
||||||
"Invalid network address in RPC listeners: %v\n", err)
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Both RPC servers may not listen on the same interface/port.
|
|
||||||
if len(cfg.LegacyRPCListeners) > 0 && len(cfg.ExperimentalRPCListeners) > 0 {
|
|
||||||
seenAddresses := make(map[string]struct{}, len(cfg.LegacyRPCListeners))
|
|
||||||
for _, addr := range cfg.LegacyRPCListeners {
|
|
||||||
seenAddresses[addr] = struct{}{}
|
|
||||||
}
|
|
||||||
for _, addr := range cfg.ExperimentalRPCListeners {
|
|
||||||
_, seen := seenAddresses[addr]
|
|
||||||
if seen {
|
|
||||||
err := fmt.Errorf("address `%s` may not be "+
|
|
||||||
"used as a listener address for both "+
|
|
||||||
"RPC servers", addr)
|
|
||||||
fmt.Fprintln(os.Stderr, err)
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if cfg.DisableServerTLS {
|
if cfg.DisableServerTLS {
|
||||||
allListeners := append(cfg.LegacyRPCListeners,
|
for _, addr := range cfg.LegacyRPCListeners {
|
||||||
cfg.ExperimentalRPCListeners...)
|
|
||||||
for _, addr := range allListeners {
|
|
||||||
_, _, err := net.SplitHostPort(addr)
|
_, _, err := net.SplitHostPort(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
str := "%s: RPC listen interface '%s' is " +
|
str := "%s: RPC listen interface '%s' is " +
|
||||||
|
|
Loading…
Add table
Reference in a new issue