mirror of
https://github.com/ncarlier/webhookd.git
synced 2025-04-20 19:50:42 +00:00
chore(version): print full version output
This commit is contained in:
parent
6565f6f6ba
commit
c3d9201e6d
|
@ -11,7 +11,6 @@ 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
|
||||||
}
|
}
|
||||||
|
@ -20,7 +19,6 @@ 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"),
|
||||||
}
|
}
|
||||||
|
|
7
main.go
7
main.go
|
@ -16,9 +16,6 @@ import (
|
||||||
"github.com/ncarlier/webhookd/pkg/worker"
|
"github.com/ncarlier/webhookd/pkg/worker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version of the app
|
|
||||||
var Version = "snapshot"
|
|
||||||
|
|
||||||
type key int
|
type key int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -32,8 +29,8 @@ var (
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *config.Version {
|
if *version {
|
||||||
fmt.Println(Version)
|
printVersion()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
version.go
Normal file
22
version.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Version of the app
|
||||||
|
var Version = "snapshot"
|
||||||
|
|
||||||
|
var (
|
||||||
|
version = flag.Bool("version", false, "Print version")
|
||||||
|
)
|
||||||
|
|
||||||
|
func printVersion() {
|
||||||
|
fmt.Printf(`webhookd (%s)
|
||||||
|
Copyright (C) 2018 Nunux, Org.
|
||||||
|
This is free software: you are free to change and redistribute it.
|
||||||
|
There is NO WARRANTY, to the extent permitted by law.
|
||||||
|
|
||||||
|
Written by Nicolas Carlier.`, Version)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user