Add Demo mode

This commit is contained in:
Leonid Bugaev
2019-01-24 23:37:53 +01:00
parent 962087065a
commit 6eea02ee86
2 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -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
+7 -1
View File
@@ -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.")