vault-usage-example/main.go

46 lines
803 B
Go
Raw Normal View History

2024-06-07 07:29:07 +03:00
package main
import (
"flag"
"log"
"runtime"
)
const (
appName = "vault-usage"
appVersion = "0.0.1"
userAgent = appName + "/" + appVersion
minimumGoMaxProcs = 4
)
var (
apiRootUri string
listenEndpoint string
)
func init() {
flag.StringVar(&apiRootUri, "api-root-uri", "/v1", "API root URI")
flag.StringVar(&listenEndpoint, "listen", ":3000", "listen (\":port\", \"address:port\")")
}
func main() {
gmp := runtime.GOMAXPROCS(0)
if gmp < minimumGoMaxProcs {
runtime.GOMAXPROCS(minimumGoMaxProcs)
}
log.SetFlags(log.Flags() | log.Lmicroseconds)
flag.Parse()
log.Printf("%s: starting\n", userAgent)
app := initFiber()
setupVaultApi(app.Group(apiRootUri))
log.Printf("%s: ready\n", userAgent)
if err := app.Listen(listenEndpoint); err != nil {
log.Fatal(err)
}
}