mirror of
https://github.com/btcsuite/btcd.git
synced 2025-01-19 05:33:36 +01:00
Merge pull request #1609 from guggero/disable-windows-service
config+service_windows: add flag to disable win service
This commit is contained in:
commit
1db1b6f821
@ -132,6 +132,7 @@ type config struct {
|
|||||||
NoOnion bool `long:"noonion" description:"Disable connecting to tor hidden services"`
|
NoOnion bool `long:"noonion" description:"Disable connecting to tor hidden services"`
|
||||||
NoPeerBloomFilters bool `long:"nopeerbloomfilters" description:"Disable bloom filtering support"`
|
NoPeerBloomFilters bool `long:"nopeerbloomfilters" description:"Disable bloom filtering support"`
|
||||||
NoRelayPriority bool `long:"norelaypriority" description:"Do not require free or low-fee transactions to have high priority for relaying"`
|
NoRelayPriority bool `long:"norelaypriority" description:"Do not require free or low-fee transactions to have high priority for relaying"`
|
||||||
|
NoWinService bool `long:"nowinservice" description:"Do not start as a background service on Windows -- NOTE: This flag only works on the command line, not in the config file"`
|
||||||
DisableRPC bool `long:"norpc" description:"Disable built-in RPC server -- NOTE: The RPC server is disabled by default if no rpcuser/rpcpass or rpclimituser/rpclimitpass is specified"`
|
DisableRPC bool `long:"norpc" description:"Disable built-in RPC server -- NOTE: The RPC server is disabled by default if no rpcuser/rpcpass or rpclimituser/rpclimitpass is specified"`
|
||||||
DisableTLS bool `long:"notls" description:"Disable TLS for the RPC server -- NOTE: This is only allowed if the RPC server is bound to localhost"`
|
DisableTLS bool `long:"notls" description:"Disable TLS for the RPC server -- NOTE: This is only allowed if the RPC server is bound to localhost"`
|
||||||
OnionProxy string `long:"onion" description:"Connect to tor hidden services via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
|
OnionProxy string `long:"onion" description:"Connect to tor hidden services via SOCKS5 proxy (eg. 127.0.0.1:9050)"`
|
||||||
|
@ -275,6 +275,22 @@ func performServiceCommand(command string) error {
|
|||||||
// returned to the caller so the application can determine whether to exit (when
|
// returned to the caller so the application can determine whether to exit (when
|
||||||
// running as a service) or launch in normal interactive mode.
|
// running as a service) or launch in normal interactive mode.
|
||||||
func serviceMain() (bool, error) {
|
func serviceMain() (bool, error) {
|
||||||
|
// Don't run as a service if the user explicitly requested it. This is
|
||||||
|
// needed to run btcd on Windows in CI environments like Travis.
|
||||||
|
// We can't use the config struct to access the value because that's not
|
||||||
|
// parsed yet. But we add the flag to the struct anyway so the parser
|
||||||
|
// won't complain about it later.
|
||||||
|
noService := false
|
||||||
|
for _, arg := range os.Args {
|
||||||
|
if arg == "--nowinservice" {
|
||||||
|
noService = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if noService {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Don't run as a service if we're running interactively (or that can't
|
// Don't run as a service if we're running interactively (or that can't
|
||||||
// be determined due to an error).
|
// be determined due to an error).
|
||||||
isInteractive, err := svc.IsAnInteractiveSession()
|
isInteractive, err := svc.IsAnInteractiveSession()
|
||||||
|
Loading…
Reference in New Issue
Block a user