mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-07 19:29:19 +00:00
feat(cli): add print version command
This commit is contained in:
parent
4e97f4b138
commit
6565f6f6ba
4
Makefile
4
Makefile
|
@ -22,7 +22,7 @@ ARTEFACT=release/$(APPNAME)-$(GOOS)-$(GOARCH)$(EXT)
|
||||||
|
|
||||||
# Extract version infos
|
# Extract version infos
|
||||||
VERSION:=`git describe --tags`
|
VERSION:=`git describe --tags`
|
||||||
LDFLAGS=-ldflags "-X $(AUTHOR)/$(APPNAME)/main.Version=${VERSION}"
|
LDFLAGS=-ldflags "-X main.Version=$(VERSION)"
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ clean:
|
||||||
## Build executable
|
## Build executable
|
||||||
build: $(APPBASE)/$(APPNAME)
|
build: $(APPBASE)/$(APPNAME)
|
||||||
-mkdir -p release
|
-mkdir -p release
|
||||||
echo "Building: $(ARTEFACT) ..."
|
echo "Building: $(ARTEFACT) $(VERSION) ..."
|
||||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(LDFLAGS) -o $(ARTEFACT)
|
GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(LDFLAGS) -o $(ARTEFACT)
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ type Config struct {
|
||||||
ListenAddr *string
|
ListenAddr *string
|
||||||
NbWorkers *int
|
NbWorkers *int
|
||||||
Debug *bool
|
Debug *bool
|
||||||
|
Version *bool
|
||||||
Timeout *int
|
Timeout *int
|
||||||
ScriptDir *string
|
ScriptDir *string
|
||||||
}
|
}
|
||||||
|
@ -19,6 +20,7 @@ var config = &Config{
|
||||||
ListenAddr: flag.String("listen", getEnv("LISTEN_ADDR", ":8080"), "HTTP service address (e.g.address, ':8080')"),
|
ListenAddr: flag.String("listen", getEnv("LISTEN_ADDR", ":8080"), "HTTP service address (e.g.address, ':8080')"),
|
||||||
NbWorkers: flag.Int("nb-workers", getIntEnv("NB_WORKERS", 2), "The number of workers to start"),
|
NbWorkers: flag.Int("nb-workers", getIntEnv("NB_WORKERS", 2), "The number of workers to start"),
|
||||||
Debug: flag.Bool("debug", getBoolEnv("DEBUG", false), "Output debug logs"),
|
Debug: flag.Bool("debug", getBoolEnv("DEBUG", false), "Output debug logs"),
|
||||||
|
Version: flag.Bool("version", false, "Output version"),
|
||||||
Timeout: flag.Int("timeout", getIntEnv("HOOK_TIMEOUT", 10), "Hook maximum delay before timeout (in second)"),
|
Timeout: flag.Int("timeout", getIntEnv("HOOK_TIMEOUT", 10), "Hook maximum delay before timeout (in second)"),
|
||||||
ScriptDir: flag.String("scripts", getEnv("SCRIPTS_DIR", "scripts"), "Scripts directory"),
|
ScriptDir: flag.String("scripts", getEnv("SCRIPTS_DIR", "scripts"), "Scripts directory"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user