support gin production mode.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2016-03-27 21:12:11 +08:00
parent 59beeb7183
commit 9370c7f049
3 changed files with 9 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ type ConfYaml struct {
type SectionCore struct {
Port string `yaml:"port"`
NotificationMax int `yaml:"notification_max"`
Production bool `yaml:"production"`
}
type SectionApi struct {
@@ -41,6 +42,7 @@ func BuildDefaultPushConf() ConfYaml {
// Core
conf.Core.Port = "8088"
conf.Core.NotificationMax = 100
conf.Core.Production = true
// Api
conf.Api.PushUri = "/api/push"

View File

@@ -40,6 +40,10 @@ func pushHandler(c *gin.Context) {
}
func GetMainEngine() *gin.Engine {
if PushConf.Core.Production {
gin.SetMode(gin.ReleaseMode)
}
r := gin.New()
// Global middleware