waba-coreapp-mock/main.go

32 lines
552 B
Go
Raw Normal View History

2022-04-21 15:07:13 +03:00
package main
import (
2022-04-21 16:54:08 +03:00
"net/http"
2022-04-21 15:07:13 +03:00
"os"
2022-04-21 16:54:08 +03:00
"time"
2022-04-21 15:07:13 +03:00
"github.com/gin-gonic/gin"
"github.com/mkideal/cli"
)
type CLI struct {
cli.Helper2
Address string `cli:"*addr,address" usage:"Address to listen"`
Verbose bool `cli:"v,verbose" usage:"Enable verbose logging"`
}
func main() {
os.Exit(cli.Run(new(CLI), func(ctx *cli.Context) error {
argv := ctx.Argv().(*CLI)
gin.SetMode(gin.ReleaseMode)
if argv.Verbose {
gin.SetMode(gin.DebugMode)
}
2022-04-21 16:54:08 +03:00
http.DefaultClient.Timeout = time.Second * 30
2022-04-21 15:07:13 +03:00
return NewServer().Run(argv.Address)
}))
}