From 0df2bcd18cc8dde2dc6e50e25c5aaab55de19091 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 25 Jul 2018 03:30:12 -0700 Subject: [PATCH 1/2] htlcswitch/hodl/config_debug: only expose hodl flags in debug This commit places hodl command line flags behind the debug flag, so that they're only accessible during testing builds. --- htlcswitch/hodl/{config.go => config_debug.go} | 2 ++ 1 file changed, 2 insertions(+) rename htlcswitch/hodl/{config.go => config_debug.go} (99%) diff --git a/htlcswitch/hodl/config.go b/htlcswitch/hodl/config_debug.go similarity index 99% rename from htlcswitch/hodl/config.go rename to htlcswitch/hodl/config_debug.go index 22a65b52..957eb50d 100644 --- a/htlcswitch/hodl/config.go +++ b/htlcswitch/hodl/config_debug.go @@ -1,3 +1,5 @@ +// +build debug + package hodl // Config is a struct enumerating the possible command line flags that are used From a5e841c6b79e741dfb91cc47b54d7336b8165772 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 25 Jul 2018 03:31:09 -0700 Subject: [PATCH 2/2] htlcswitch/hodl/config_production: hide cli hodl flags in prod This commit replaces the debug Config struct with an empty one, so that the command line flags are hidden in production builds. Production help before commit: Tor: --tor.active --tor.socks= --tor.dns= --tor.streamisolation --tor.control= --tor.v2 --tor.v2privatekeypath= --tor.v3 hodl: --hodl.exit-settle --hodl.add-incoming --hodl.settle-incoming --hodl.fail-incoming --hodl.add-outgoing --hodl.settle-outgoing --hodl.fail-outgoing --hodl.commit --hodl.bogus-settle Help Options: -h, --help Production help after commit: Tor: --tor.active --tor.socks= --tor.dns= --tor.streamisolation --tor.control= --tor.v2 --tor.v2privatekeypath= --tor.v3 Help Options: -h, --help --- htlcswitch/hodl/config_production.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 htlcswitch/hodl/config_production.go diff --git a/htlcswitch/hodl/config_production.go b/htlcswitch/hodl/config_production.go new file mode 100644 index 00000000..8daeefd8 --- /dev/null +++ b/htlcswitch/hodl/config_production.go @@ -0,0 +1,11 @@ +// +build !debug + +package hodl + +// Config is an empty struct disabling command line hodl flags in production. +type Config struct{} + +// Mask in production always returns MaskNone. +func (c *Config) Mask() Mask { + return MaskNone +}