feat(goswagger): Continue on goswagger template
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
65add2a61d
commit
9683e21ed4
@ -51,6 +51,7 @@ type Config struct {
|
|||||||
{{ pascalize .Name }}API
|
{{ pascalize .Name }}API
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
Logger func(string, ...interface{})
|
Logger func(string, ...interface{})
|
||||||
|
|
||||||
// InnerMiddleware is for the handler executors. These do not apply to the swagger.json document.
|
// InnerMiddleware is for the handler executors. These do not apply to the swagger.json document.
|
||||||
// The middleware executes after routing but before authentication, binding and validation
|
// The middleware executes after routing but before authentication, binding and validation
|
||||||
InnerMiddleware func(http.Handler) http.Handler
|
InnerMiddleware func(http.Handler) http.Handler
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
// initTag is the signature of the function that tag initialization should respect.
|
// initTag is the signature of the function that tag initialization should respect.
|
||||||
type initTag func(*restapi.Config) error
|
type initTag func(*restapi.Config) error
|
||||||
|
|
||||||
// tagswill be fulfill by init function in tag_XXX.go.
|
// tags will be fulfill by init function in tag_XXX.go.
|
||||||
var tags = map[string]initTag{}
|
var tags = map[string]initTag{}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -33,6 +33,12 @@ func main() {
|
|||||||
logrus.WithError(err).Fatal("fail to initialize gocommon.log")
|
logrus.WithError(err).Fatal("fail to initialize gocommon.log")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize listenAddress
|
||||||
|
listenAddress, err := server.GetListenAddressFromEnvOrFlags()
|
||||||
|
if err != nil {
|
||||||
|
logger.WithError(err).Fatal("fail to initalize listenAddress")
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize tracing
|
// Initialize tracing
|
||||||
logger.Info("Initializing tracing")
|
logger.Info("Initializing tracing")
|
||||||
tp, err := tracing.Init()
|
tp, err := tracing.Init()
|
||||||
@ -62,8 +68,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
srv := http.Server{
|
srv := http.Server{
|
||||||
Addr: ":8081",
|
Addr: listenAddress,
|
||||||
Handler: h,
|
Handler: h,
|
||||||
IdleTimeout: 30 * time.Second,
|
IdleTimeout: 30 * time.Second,
|
||||||
ReadHeaderTimeout: 2 * time.Second,
|
ReadHeaderTimeout: 2 * time.Second,
|
||||||
ReadTimeout: 1 * time.Second,
|
ReadTimeout: 1 * time.Second,
|
||||||
|
Loading…
Reference in New Issue
Block a user