diff --git a/Makefile b/Makefile index 51b02a7..7dc58e6 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,8 @@ RUN = docker run -v `pwd`:$(SOURCE_PATH) -e AWS_ACCESS_KEY_ID=AKIAIOJPOSYCQCWU4Y BENCHMARK = BenchmarkRAWInput TEST = TestRawListenerBench VERSION = DEV-$(shell date +%s) -LDFLAGS = -ldflags "-X main.VERSION=$(VERSION)_PRO -extldflags \"-static\"" -MAC_LDFLAGS = -ldflags "-X main.VERSION=$(VERSION)_PRO" +LDFLAGS = -ldflags "-X main.VERSION=$(VERSION)_PRO -extldflags \"-static\" -X main.DEMO=$(DEMO)" +MAC_LDFLAGS = -ldflags "-X main.VERSION=$(VERSION)_PRO -X main.DEMO=$(DEMO)" FADDR = ":8000" release: release-x64 release-mac diff --git a/settings.go b/settings.go index 6fcb11d..a682ba6 100644 --- a/settings.go +++ b/settings.go @@ -9,6 +9,7 @@ import ( ) var VERSION string +var DEMO string // MultiOption allows to specify multiple flags with same name and collects all values into array type MultiOption []string @@ -91,7 +92,12 @@ func init() { flag.BoolVar(&Settings.verbose, "verbose", false, "Turn on more verbose output") flag.BoolVar(&Settings.debug, "debug", false, "Turn on debug output, shows all intercepted traffic. Works only when with `verbose` flag") flag.BoolVar(&Settings.stats, "stats", false, "Turn on queue stats output") - flag.DurationVar(&Settings.exitAfter, "exit-after", 0, "exit after specified duration") + + if DEMO == "" { + flag.DurationVar(&Settings.exitAfter, "exit-after", 0, "exit after specified duration") + } else { + Settings.exitAfter = 5 * time.Minute + } flag.BoolVar(&Settings.splitOutput, "split-output", false, "By default each output gets same traffic. If set to `true` it splits traffic equally among all outputs.")