support gin production mode.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user