support gin production mode.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
59beeb7183
commit
9370c7f049
|
@ -1,17 +1,18 @@
|
|||
core:
|
||||
port: "8088"
|
||||
notification_max: 100
|
||||
production: true
|
||||
|
||||
api:
|
||||
push_uri: "/api/push"
|
||||
stat_go_uri: "/api/status"
|
||||
|
||||
android:
|
||||
enabled: true
|
||||
enabled: false
|
||||
apikey: ""
|
||||
|
||||
ios:
|
||||
enabled: true
|
||||
enabled: false
|
||||
pem_cert_path: "cert.pem"
|
||||
pem_key_path: "key.pem"
|
||||
production: false
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue