Add change log
This commit is contained in:
parent
32d7633a04
commit
9ce8aa734a
@ -54,6 +54,7 @@
|
|||||||
- Init exceptMethod by using reflection. [4583](https://github.com/beego/beego/pull/4583)
|
- Init exceptMethod by using reflection. [4583](https://github.com/beego/beego/pull/4583)
|
||||||
- Deprecated BeeMap and replace all usage with `sync.map` [4616](https://github.com/beego/beego/pull/4616)
|
- Deprecated BeeMap and replace all usage with `sync.map` [4616](https://github.com/beego/beego/pull/4616)
|
||||||
- TaskManager support graceful shutdown [4635](https://github.com/beego/beego/pull/4635)
|
- TaskManager support graceful shutdown [4635](https://github.com/beego/beego/pull/4635)
|
||||||
|
- Add comments to `web.Config`, rename `RouterXXX` to `CtrlXXX`, define `HandleFunc` [4714](https://github.com/beego/beego/pull/4714)
|
||||||
|
|
||||||
## Fix Sonar
|
## Fix Sonar
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ type Config struct {
|
|||||||
// AppName
|
// AppName
|
||||||
// @Description Application's name. You'd better set it because we use it to do some logging and tracing
|
// @Description Application's name. You'd better set it because we use it to do some logging and tracing
|
||||||
// @Default beego
|
// @Default beego
|
||||||
AppName string // Application name
|
AppName string // Application name
|
||||||
// RunMode
|
// RunMode
|
||||||
// @Description it's the same as environment. In general, we have different run modes.
|
// @Description it's the same as environment. In general, we have different run modes.
|
||||||
// For example, the most common case is using dev, test, prod three environments
|
// For example, the most common case is using dev, test, prod three environments
|
||||||
@ -49,7 +49,7 @@ type Config struct {
|
|||||||
// You should never set RunMode="dev" when you deploy the application to prod
|
// You should never set RunMode="dev" when you deploy the application to prod
|
||||||
// because Beego will do more things which need Go SDK and other tools when it found out the RunMode="dev"
|
// because Beego will do more things which need Go SDK and other tools when it found out the RunMode="dev"
|
||||||
// @Default dev
|
// @Default dev
|
||||||
RunMode string // Running Mode: dev | prod
|
RunMode string // Running Mode: dev | prod
|
||||||
|
|
||||||
// RouterCaseSensitive
|
// RouterCaseSensitive
|
||||||
// @Description If it was true, it means that the router is case sensitive.
|
// @Description If it was true, it means that the router is case sensitive.
|
||||||
@ -62,7 +62,7 @@ type Config struct {
|
|||||||
// @Description if it was true, Beego will try to recover from panic when it serves your http request
|
// @Description if it was true, Beego will try to recover from panic when it serves your http request
|
||||||
// So you should notice that it doesn't mean that Beego will recover all panic cases.
|
// So you should notice that it doesn't mean that Beego will recover all panic cases.
|
||||||
// @Default true
|
// @Default true
|
||||||
RecoverPanic bool
|
RecoverPanic bool
|
||||||
// CopyRequestBody
|
// CopyRequestBody
|
||||||
// @Description if it's true, Beego will copy the request body. But if the request body's size > MaxMemory,
|
// @Description if it's true, Beego will copy the request body. But if the request body's size > MaxMemory,
|
||||||
// Beego will return 413 as http status
|
// Beego will return 413 as http status
|
||||||
@ -70,14 +70,14 @@ type Config struct {
|
|||||||
// And if you want to read data from request Body multiple times, please set it to true
|
// And if you want to read data from request Body multiple times, please set it to true
|
||||||
// In general, if you don't meet any performance issue, you could set it to true
|
// In general, if you don't meet any performance issue, you could set it to true
|
||||||
// @Default false
|
// @Default false
|
||||||
CopyRequestBody bool
|
CopyRequestBody bool
|
||||||
// EnableGzip
|
// EnableGzip
|
||||||
// @Description If it was true, Beego will try to compress data by using zip algorithm.
|
// @Description If it was true, Beego will try to compress data by using zip algorithm.
|
||||||
// But there are two points:
|
// But there are two points:
|
||||||
// 1. Only static resources will be compressed
|
// 1. Only static resources will be compressed
|
||||||
// 2. Only those static resource which has the extension specified by StaticExtensionsToGzip will be compressed
|
// 2. Only those static resource which has the extension specified by StaticExtensionsToGzip will be compressed
|
||||||
// @Default false
|
// @Default false
|
||||||
EnableGzip bool
|
EnableGzip bool
|
||||||
// EnableErrorsShow
|
// EnableErrorsShow
|
||||||
// @Description If it's true, Beego will show error message to page
|
// @Description If it's true, Beego will show error message to page
|
||||||
// it will work with ErrorMaps which allows you register some error handler
|
// it will work with ErrorMaps which allows you register some error handler
|
||||||
@ -85,25 +85,25 @@ type Config struct {
|
|||||||
// because you may not want to expose your internal error msg to your users
|
// because you may not want to expose your internal error msg to your users
|
||||||
// it's a little bit unsafe
|
// it's a little bit unsafe
|
||||||
// @Default true
|
// @Default true
|
||||||
EnableErrorsShow bool
|
EnableErrorsShow bool
|
||||||
// EnableErrorsRender
|
// EnableErrorsRender
|
||||||
// @Description If it's true, it will output the error msg as a page. It's similar to EnableErrorsShow
|
// @Description If it's true, it will output the error msg as a page. It's similar to EnableErrorsShow
|
||||||
// And this configure item only work in dev run mode (see RunMode)
|
// And this configure item only work in dev run mode (see RunMode)
|
||||||
// @Default true
|
// @Default true
|
||||||
EnableErrorsRender bool
|
EnableErrorsRender bool
|
||||||
// ServerName
|
// ServerName
|
||||||
// @Description server name. For example, in large scale system,
|
// @Description server name. For example, in large scale system,
|
||||||
// you may want to deploy your application to several machines, so that each of them has a server name
|
// you may want to deploy your application to several machines, so that each of them has a server name
|
||||||
// we suggest you'd better set value because Beego use this to output some DEBUG msg,
|
// we suggest you'd better set value because Beego use this to output some DEBUG msg,
|
||||||
// or integrated with other tools such as tracing, metrics
|
// or integrated with other tools such as tracing, metrics
|
||||||
// @Default
|
// @Default
|
||||||
ServerName string
|
ServerName string
|
||||||
|
|
||||||
// RecoverFunc
|
// RecoverFunc
|
||||||
// @Description when Beego want to recover from panic, it will use this func as callback
|
// @Description when Beego want to recover from panic, it will use this func as callback
|
||||||
// see RecoverPanic
|
// see RecoverPanic
|
||||||
// @Default defaultRecoverPanic
|
// @Default defaultRecoverPanic
|
||||||
RecoverFunc func(*context.Context, *Config)
|
RecoverFunc func(*context.Context, *Config)
|
||||||
// @Description MaxMemory and MaxUploadSize are used to limit the request body
|
// @Description MaxMemory and MaxUploadSize are used to limit the request body
|
||||||
// if the request is not uploading file, MaxMemory is the max size of request body
|
// if the request is not uploading file, MaxMemory is the max size of request body
|
||||||
// if the request is uploading file, MaxUploadSize is the max size of request body
|
// if the request is uploading file, MaxUploadSize is the max size of request body
|
||||||
@ -111,7 +111,7 @@ type Config struct {
|
|||||||
// see CopyRequestBody
|
// see CopyRequestBody
|
||||||
// the default value is 1 << 26 (64MB)
|
// the default value is 1 << 26 (64MB)
|
||||||
// @Default 67108864
|
// @Default 67108864
|
||||||
MaxMemory int64
|
MaxMemory int64
|
||||||
// MaxUploadSize
|
// MaxUploadSize
|
||||||
// @Description MaxMemory and MaxUploadSize are used to limit the request body
|
// @Description MaxMemory and MaxUploadSize are used to limit the request body
|
||||||
// if the request is not uploading file, MaxMemory is the max size of request body
|
// if the request is not uploading file, MaxMemory is the max size of request body
|
||||||
@ -121,13 +121,13 @@ type Config struct {
|
|||||||
MaxUploadSize int64
|
MaxUploadSize int64
|
||||||
// Listen
|
// Listen
|
||||||
// @Description the configuration about socket or http protocol
|
// @Description the configuration about socket or http protocol
|
||||||
Listen Listen
|
Listen Listen
|
||||||
// WebConfig
|
// WebConfig
|
||||||
// @Description the configuration about Web
|
// @Description the configuration about Web
|
||||||
WebConfig WebConfig
|
WebConfig WebConfig
|
||||||
// LogConfig
|
// LogConfig
|
||||||
// @Description log configuration
|
// @Description log configuration
|
||||||
Log LogConfig
|
Log LogConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen holds for http and https related config
|
// Listen holds for http and https related config
|
||||||
@ -135,32 +135,32 @@ type Listen struct {
|
|||||||
// Graceful
|
// Graceful
|
||||||
// @Description means use graceful module to start the server
|
// @Description means use graceful module to start the server
|
||||||
// @Default false
|
// @Default false
|
||||||
Graceful bool
|
Graceful bool
|
||||||
// ListenTCP4
|
// ListenTCP4
|
||||||
// @Description if it's true, means that Beego only work for TCP4
|
// @Description if it's true, means that Beego only work for TCP4
|
||||||
// please check net.Listen function
|
// please check net.Listen function
|
||||||
// In general, you should not set it to true
|
// In general, you should not set it to true
|
||||||
// @Default false
|
// @Default false
|
||||||
ListenTCP4 bool
|
ListenTCP4 bool
|
||||||
// EnableHTTP
|
// EnableHTTP
|
||||||
// @Description if it's true, Beego will accept HTTP request.
|
// @Description if it's true, Beego will accept HTTP request.
|
||||||
// But if you want to use HTTPS only, please set it to false
|
// But if you want to use HTTPS only, please set it to false
|
||||||
// see EnableHTTPS
|
// see EnableHTTPS
|
||||||
// @Default true
|
// @Default true
|
||||||
EnableHTTP bool
|
EnableHTTP bool
|
||||||
// AutoTLS
|
// AutoTLS
|
||||||
// @Description If it's true, Beego will use default value to initialize the TLS configure
|
// @Description If it's true, Beego will use default value to initialize the TLS configure
|
||||||
// But those values could be override if you have custom value.
|
// But those values could be override if you have custom value.
|
||||||
// see Domains, TLSCacheDir
|
// see Domains, TLSCacheDir
|
||||||
// @Default false
|
// @Default false
|
||||||
AutoTLS bool
|
AutoTLS bool
|
||||||
// EnableHTTPS
|
// EnableHTTPS
|
||||||
// @Description If it's true, Beego will accept HTTPS request.
|
// @Description If it's true, Beego will accept HTTPS request.
|
||||||
// Now, you'd better use HTTPS protocol on prod environment to get better security
|
// Now, you'd better use HTTPS protocol on prod environment to get better security
|
||||||
// In prod, the best option is EnableHTTPS=true and EnableHTTP=false
|
// In prod, the best option is EnableHTTPS=true and EnableHTTP=false
|
||||||
// see EnableHTTP
|
// see EnableHTTP
|
||||||
// @Default false
|
// @Default false
|
||||||
EnableHTTPS bool
|
EnableHTTPS bool
|
||||||
// EnableMutualHTTPS
|
// EnableMutualHTTPS
|
||||||
// @Description if it's true, Beego will handle requests on incoming mutual TLS connections
|
// @Description if it's true, Beego will handle requests on incoming mutual TLS connections
|
||||||
// see Server.ListenAndServeMutualTLS
|
// see Server.ListenAndServeMutualTLS
|
||||||
@ -172,76 +172,76 @@ type Listen struct {
|
|||||||
// The default port is 8088
|
// The default port is 8088
|
||||||
// see AdminPort
|
// see AdminPort
|
||||||
// @Default false
|
// @Default false
|
||||||
EnableAdmin bool
|
EnableAdmin bool
|
||||||
// EnableFcgi
|
// EnableFcgi
|
||||||
// @Description
|
// @Description
|
||||||
// @Default false
|
// @Default false
|
||||||
EnableFcgi bool
|
EnableFcgi bool
|
||||||
// EnableStdIo
|
// EnableStdIo
|
||||||
// @Description EnableStdIo works with EnableFcgi Use FCGI via standard I/O
|
// @Description EnableStdIo works with EnableFcgi Use FCGI via standard I/O
|
||||||
// @Default false
|
// @Default false
|
||||||
EnableStdIo bool
|
EnableStdIo bool
|
||||||
// ServerTimeOut
|
// ServerTimeOut
|
||||||
// @Description Beego use this as ReadTimeout and WriteTimeout
|
// @Description Beego use this as ReadTimeout and WriteTimeout
|
||||||
// The unit is second.
|
// The unit is second.
|
||||||
// see http.Server.ReadTimeout, WriteTimeout
|
// see http.Server.ReadTimeout, WriteTimeout
|
||||||
// @Default 0
|
// @Default 0
|
||||||
ServerTimeOut int64
|
ServerTimeOut int64
|
||||||
// HTTPAddr
|
// HTTPAddr
|
||||||
// @Description Beego listen to this address when the application start up.
|
// @Description Beego listen to this address when the application start up.
|
||||||
// @Default ""
|
// @Default ""
|
||||||
HTTPAddr string
|
HTTPAddr string
|
||||||
// HTTPPort
|
// HTTPPort
|
||||||
// @Description Beego listen to this port
|
// @Description Beego listen to this port
|
||||||
// you'd better change this value when you deploy to prod environment
|
// you'd better change this value when you deploy to prod environment
|
||||||
// @Default 8080
|
// @Default 8080
|
||||||
HTTPPort int
|
HTTPPort int
|
||||||
// Domains
|
// Domains
|
||||||
// @Description Beego use this to configure TLS. Those domains are "white list" domain
|
// @Description Beego use this to configure TLS. Those domains are "white list" domain
|
||||||
// @Default []
|
// @Default []
|
||||||
Domains []string
|
Domains []string
|
||||||
// TLSCacheDir
|
// TLSCacheDir
|
||||||
// @Description Beego use this as cache dir to store TLS cert data
|
// @Description Beego use this as cache dir to store TLS cert data
|
||||||
// @Default ""
|
// @Default ""
|
||||||
TLSCacheDir string
|
TLSCacheDir string
|
||||||
// HTTPSAddr
|
// HTTPSAddr
|
||||||
// @Description Beego will listen to this address to accept HTTPS request
|
// @Description Beego will listen to this address to accept HTTPS request
|
||||||
// see EnableHTTPS
|
// see EnableHTTPS
|
||||||
// @Default ""
|
// @Default ""
|
||||||
HTTPSAddr string
|
HTTPSAddr string
|
||||||
// HTTPSPort
|
// HTTPSPort
|
||||||
// @Description Beego will listen to this port to accept HTTPS request
|
// @Description Beego will listen to this port to accept HTTPS request
|
||||||
// @Default 10443
|
// @Default 10443
|
||||||
HTTPSPort int
|
HTTPSPort int
|
||||||
// HTTPSCertFile
|
// HTTPSCertFile
|
||||||
// @Description Beego read this file as cert file
|
// @Description Beego read this file as cert file
|
||||||
// When you are using HTTPS protocol, please configure it
|
// When you are using HTTPS protocol, please configure it
|
||||||
// see HTTPSKeyFile
|
// see HTTPSKeyFile
|
||||||
// @Default ""
|
// @Default ""
|
||||||
HTTPSCertFile string
|
HTTPSCertFile string
|
||||||
// HTTPSKeyFile
|
// HTTPSKeyFile
|
||||||
// @Description Beego read this file as key file
|
// @Description Beego read this file as key file
|
||||||
// When you are using HTTPS protocol, please configure it
|
// When you are using HTTPS protocol, please configure it
|
||||||
// see HTTPSCertFile
|
// see HTTPSCertFile
|
||||||
// @Default ""
|
// @Default ""
|
||||||
HTTPSKeyFile string
|
HTTPSKeyFile string
|
||||||
// TrustCaFile
|
// TrustCaFile
|
||||||
// @Description Beego read this file as CA file
|
// @Description Beego read this file as CA file
|
||||||
// @Default ""
|
// @Default ""
|
||||||
TrustCaFile string
|
TrustCaFile string
|
||||||
// AdminAddr
|
// AdminAddr
|
||||||
// @Description Beego will listen to this address to provide admin service
|
// @Description Beego will listen to this address to provide admin service
|
||||||
// In general, it should be the same with your application address, HTTPAddr or HTTPSAddr
|
// In general, it should be the same with your application address, HTTPAddr or HTTPSAddr
|
||||||
// @Default ""
|
// @Default ""
|
||||||
AdminAddr string
|
AdminAddr string
|
||||||
// AdminPort
|
// AdminPort
|
||||||
// @Description Beego will listen to this port to provide admin service
|
// @Description Beego will listen to this port to provide admin service
|
||||||
// @Default 8088
|
// @Default 8088
|
||||||
AdminPort int
|
AdminPort int
|
||||||
// @Description Beego use this tls.ClientAuthType to initialize TLS connection
|
// @Description Beego use this tls.ClientAuthType to initialize TLS connection
|
||||||
// The default value is tls.RequireAndVerifyClientCert
|
// The default value is tls.RequireAndVerifyClientCert
|
||||||
// @Default 4
|
// @Default 4
|
||||||
ClientAuth int
|
ClientAuth int
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebConfig holds web related config
|
// WebConfig holds web related config
|
||||||
@ -252,9 +252,9 @@ type WebConfig struct {
|
|||||||
// But if you are building RESTFul API and you don't have any page,
|
// But if you are building RESTFul API and you don't have any page,
|
||||||
// you can set it to false
|
// you can set it to false
|
||||||
// @Default true
|
// @Default true
|
||||||
AutoRender bool
|
AutoRender bool
|
||||||
// Deprecated: Beego didn't use it anymore
|
// Deprecated: Beego didn't use it anymore
|
||||||
EnableDocs bool
|
EnableDocs bool
|
||||||
// EnableXSRF
|
// EnableXSRF
|
||||||
// @Description If it's true, Beego will help to provide XSRF support
|
// @Description If it's true, Beego will help to provide XSRF support
|
||||||
// But you should notice that, now Beego only work for HTTPS protocol with XSRF
|
// But you should notice that, now Beego only work for HTTPS protocol with XSRF
|
||||||
@ -264,22 +264,22 @@ type WebConfig struct {
|
|||||||
// This is completed different from Beego 1.x because we got many security reports
|
// This is completed different from Beego 1.x because we got many security reports
|
||||||
// And if you are in dev environment, you could set it to false
|
// And if you are in dev environment, you could set it to false
|
||||||
// @Default false
|
// @Default false
|
||||||
EnableXSRF bool
|
EnableXSRF bool
|
||||||
// DirectoryIndex
|
// DirectoryIndex
|
||||||
// @Description When Beego serves static resources request, it will look up the file.
|
// @Description When Beego serves static resources request, it will look up the file.
|
||||||
// If the file is directory, Beego will try to find the index.html as the response
|
// If the file is directory, Beego will try to find the index.html as the response
|
||||||
// But if the index.html is not exist or it's a directory,
|
// But if the index.html is not exist or it's a directory,
|
||||||
// Beego will return 403 response if DirectoryIndex is **false**
|
// Beego will return 403 response if DirectoryIndex is **false**
|
||||||
// @Default false
|
// @Default false
|
||||||
DirectoryIndex bool
|
DirectoryIndex bool
|
||||||
// FlashName
|
// FlashName
|
||||||
// @Description the cookie's name when Beego try to store the flash data into cookie
|
// @Description the cookie's name when Beego try to store the flash data into cookie
|
||||||
// @Default BEEGO_FLASH
|
// @Default BEEGO_FLASH
|
||||||
FlashName string
|
FlashName string
|
||||||
// FlashSeparator
|
// FlashSeparator
|
||||||
// @Description When Beego read flash data from request, it uses this as the separator
|
// @Description When Beego read flash data from request, it uses this as the separator
|
||||||
// @Default BEEGOFLASH
|
// @Default BEEGOFLASH
|
||||||
FlashSeparator string
|
FlashSeparator string
|
||||||
// StaticDir
|
// StaticDir
|
||||||
// @Description Beego uses this as static resources' root directory.
|
// @Description Beego uses this as static resources' root directory.
|
||||||
// It means that Beego will try to search static resource from this start point
|
// It means that Beego will try to search static resource from this start point
|
||||||
@ -288,9 +288,9 @@ type WebConfig struct {
|
|||||||
// which means that when Beego got a request with path /static/xxx
|
// which means that when Beego got a request with path /static/xxx
|
||||||
// Beego will try to find the resource from static directory
|
// Beego will try to find the resource from static directory
|
||||||
// @Default /static => static
|
// @Default /static => static
|
||||||
StaticDir map[string]string
|
StaticDir map[string]string
|
||||||
// StaticExtensionsToGzip
|
// StaticExtensionsToGzip
|
||||||
// @Description The static resources with those extension wille be compressed if EnableGzip is true
|
// @Description The static resources with those extension will be compressed if EnableGzip is true
|
||||||
// @Default [".css", ".js" ]
|
// @Default [".css", ".js" ]
|
||||||
StaticExtensionsToGzip []string
|
StaticExtensionsToGzip []string
|
||||||
// StaticCacheFileSize
|
// StaticCacheFileSize
|
||||||
@ -301,45 +301,45 @@ type WebConfig struct {
|
|||||||
// the max memory size of caching static files is StaticCacheFileSize * StaticCacheFileNum
|
// the max memory size of caching static files is StaticCacheFileSize * StaticCacheFileNum
|
||||||
// see StaticCacheFileNum
|
// see StaticCacheFileNum
|
||||||
// @Default 102400
|
// @Default 102400
|
||||||
StaticCacheFileSize int
|
StaticCacheFileSize int
|
||||||
// StaticCacheFileNum
|
// StaticCacheFileNum
|
||||||
// @Description Beego use it to control the memory usage of caching static resource file
|
// @Description Beego use it to control the memory usage of caching static resource file
|
||||||
// If the caching files > StaticCacheFileNum, Beego use LRU algorithm to remove caching file
|
// If the caching files > StaticCacheFileNum, Beego use LRU algorithm to remove caching file
|
||||||
// the max memory size of caching static files is StaticCacheFileSize * StaticCacheFileNum
|
// the max memory size of caching static files is StaticCacheFileSize * StaticCacheFileNum
|
||||||
// see StaticCacheFileSize
|
// see StaticCacheFileSize
|
||||||
// @Default 1000
|
// @Default 1000
|
||||||
StaticCacheFileNum int
|
StaticCacheFileNum int
|
||||||
// TemplateLeft
|
// TemplateLeft
|
||||||
// @Description Beego use this to render page
|
// @Description Beego use this to render page
|
||||||
// see TemplateRight
|
// see TemplateRight
|
||||||
// @Default {{
|
// @Default {{
|
||||||
TemplateLeft string
|
TemplateLeft string
|
||||||
// TemplateRight
|
// TemplateRight
|
||||||
// @Description Beego use this to render page
|
// @Description Beego use this to render page
|
||||||
// see TemplateLeft
|
// see TemplateLeft
|
||||||
// @Default }}
|
// @Default }}
|
||||||
TemplateRight string
|
TemplateRight string
|
||||||
// ViewsPath
|
// ViewsPath
|
||||||
// @Description The directory of Beego application storing template
|
// @Description The directory of Beego application storing template
|
||||||
// @Default views
|
// @Default views
|
||||||
ViewsPath string
|
ViewsPath string
|
||||||
// CommentRouterPath
|
// CommentRouterPath
|
||||||
// @Description Beego scans this directory and its sub directory to generate router
|
// @Description Beego scans this directory and its sub directory to generate router
|
||||||
// Beego only scans this directory when it's in dev environment
|
// Beego only scans this directory when it's in dev environment
|
||||||
// @Default controllers
|
// @Default controllers
|
||||||
CommentRouterPath string
|
CommentRouterPath string
|
||||||
// XSRFKey
|
// XSRFKey
|
||||||
// @Description the name of cookie storing XSRF token
|
// @Description the name of cookie storing XSRF token
|
||||||
// see EnableXSRF
|
// see EnableXSRF
|
||||||
// @Default beegoxsrf
|
// @Default beegoxsrf
|
||||||
XSRFKey string
|
XSRFKey string
|
||||||
// XSRFExpire
|
// XSRFExpire
|
||||||
// @Description the expiration time of XSRF token cookie
|
// @Description the expiration time of XSRF token cookie
|
||||||
// second
|
// second
|
||||||
// @Default 0
|
// @Default 0
|
||||||
XSRFExpire int
|
XSRFExpire int
|
||||||
// @Description session related config
|
// @Description session related config
|
||||||
Session SessionConfig
|
Session SessionConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// SessionConfig holds session related config
|
// SessionConfig holds session related config
|
||||||
@ -347,16 +347,16 @@ type SessionConfig struct {
|
|||||||
// SessionOn
|
// SessionOn
|
||||||
// @Description if it's true, Beego will auto manage session
|
// @Description if it's true, Beego will auto manage session
|
||||||
// @Default false
|
// @Default false
|
||||||
SessionOn bool
|
SessionOn bool
|
||||||
// SessionAutoSetCookie
|
// SessionAutoSetCookie
|
||||||
// @Description if it's true, Beego will put the session token into cookie too
|
// @Description if it's true, Beego will put the session token into cookie too
|
||||||
// @Default true
|
// @Default true
|
||||||
SessionAutoSetCookie bool
|
SessionAutoSetCookie bool
|
||||||
// SessionDisableHTTPOnly
|
// SessionDisableHTTPOnly
|
||||||
// @Description used to allow for cross domain cookies/javascript cookies
|
// @Description used to allow for cross domain cookies/javascript cookies
|
||||||
// In general, you should not set it to true unless you understand the risk
|
// In general, you should not set it to true unless you understand the risk
|
||||||
// @Default false
|
// @Default false
|
||||||
SessionDisableHTTPOnly bool
|
SessionDisableHTTPOnly bool
|
||||||
// SessionEnableSidInHTTPHeader
|
// SessionEnableSidInHTTPHeader
|
||||||
// @Description enable store/get the sessionId into/from http headers
|
// @Description enable store/get the sessionId into/from http headers
|
||||||
// @Default false
|
// @Default false
|
||||||
@ -364,47 +364,47 @@ type SessionConfig struct {
|
|||||||
// SessionEnableSidInURLQuery
|
// SessionEnableSidInURLQuery
|
||||||
// @Description enable get the sessionId from Url Query params
|
// @Description enable get the sessionId from Url Query params
|
||||||
// @Default false
|
// @Default false
|
||||||
SessionEnableSidInURLQuery bool
|
SessionEnableSidInURLQuery bool
|
||||||
// SessionProvider
|
// SessionProvider
|
||||||
// @Description session provider's name.
|
// @Description session provider's name.
|
||||||
// You should confirm that this provider has been register via session.Register method
|
// You should confirm that this provider has been register via session.Register method
|
||||||
// the default value is memory. This is not suitable for distributed system
|
// the default value is memory. This is not suitable for distributed system
|
||||||
// @Default memory
|
// @Default memory
|
||||||
SessionProvider string
|
SessionProvider string
|
||||||
// SessionName
|
// SessionName
|
||||||
// @Description If SessionAutoSetCookie is true, we use this value as the cookie's name
|
// @Description If SessionAutoSetCookie is true, we use this value as the cookie's name
|
||||||
// @Default beegosessionID
|
// @Default beegosessionID
|
||||||
SessionName string
|
SessionName string
|
||||||
// SessionGCMaxLifetime
|
// SessionGCMaxLifetime
|
||||||
// @Description Beego will GC session to clean useless session.
|
// @Description Beego will GC session to clean useless session.
|
||||||
// unit: second
|
// unit: second
|
||||||
// @Default 3600
|
// @Default 3600
|
||||||
SessionGCMaxLifetime int64
|
SessionGCMaxLifetime int64
|
||||||
// SessionProviderConfig
|
// SessionProviderConfig
|
||||||
// @Description the config of session provider
|
// @Description the config of session provider
|
||||||
// see SessionProvider
|
// see SessionProvider
|
||||||
// you should read the document of session provider to learn how to set this value
|
// you should read the document of session provider to learn how to set this value
|
||||||
// @Default ""
|
// @Default ""
|
||||||
SessionProviderConfig string
|
SessionProviderConfig string
|
||||||
// SessionCookieLifeTime
|
// SessionCookieLifeTime
|
||||||
// @Description If SessionAutoSetCookie is true,
|
// @Description If SessionAutoSetCookie is true,
|
||||||
// we use this value as the expiration time and max age of the cookie
|
// we use this value as the expiration time and max age of the cookie
|
||||||
// unit second
|
// unit second
|
||||||
// @Default 0
|
// @Default 0
|
||||||
SessionCookieLifeTime int
|
SessionCookieLifeTime int
|
||||||
// SessionDomain
|
// SessionDomain
|
||||||
// @Description If SessionAutoSetCookie is true, we use this value as the cookie's domain
|
// @Description If SessionAutoSetCookie is true, we use this value as the cookie's domain
|
||||||
// @Default ""
|
// @Default ""
|
||||||
SessionDomain string
|
SessionDomain string
|
||||||
// SessionNameInHTTPHeader
|
// SessionNameInHTTPHeader
|
||||||
// @Description if SessionEnableSidInHTTPHeader is true, this value will be used as the http header
|
// @Description if SessionEnableSidInHTTPHeader is true, this value will be used as the http header
|
||||||
// @Default Beegosessionid
|
// @Default Beegosessionid
|
||||||
SessionNameInHTTPHeader string
|
SessionNameInHTTPHeader string
|
||||||
// SessionCookieSameSite
|
// SessionCookieSameSite
|
||||||
// @Description If SessionAutoSetCookie is true, we use this value as the cookie's same site policy
|
// @Description If SessionAutoSetCookie is true, we use this value as the cookie's same site policy
|
||||||
// the default value is http.SameSiteDefaultMode
|
// the default value is http.SameSiteDefaultMode
|
||||||
// @Default 1
|
// @Default 1
|
||||||
SessionCookieSameSite http.SameSite
|
SessionCookieSameSite http.SameSite
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogConfig holds Log related config
|
// LogConfig holds Log related config
|
||||||
@ -412,7 +412,7 @@ type LogConfig struct {
|
|||||||
// AccessLogs
|
// AccessLogs
|
||||||
// @Description If it's true, Beego will log the HTTP request info
|
// @Description If it's true, Beego will log the HTTP request info
|
||||||
// @Default false
|
// @Default false
|
||||||
AccessLogs bool
|
AccessLogs bool
|
||||||
// EnableStaticLogs
|
// EnableStaticLogs
|
||||||
// @Description log static files requests
|
// @Description log static files requests
|
||||||
// @Default false
|
// @Default false
|
||||||
@ -420,7 +420,7 @@ type LogConfig struct {
|
|||||||
// FileLineNum
|
// FileLineNum
|
||||||
// @Description if it's true, it will log the line number
|
// @Description if it's true, it will log the line number
|
||||||
// @Default true
|
// @Default true
|
||||||
FileLineNum bool
|
FileLineNum bool
|
||||||
// AccessLogsFormat
|
// AccessLogsFormat
|
||||||
// @Description access log format: JSON_FORMAT, APACHE_FORMAT or empty string
|
// @Description access log format: JSON_FORMAT, APACHE_FORMAT or empty string
|
||||||
// @Default APACHE_FORMAT
|
// @Default APACHE_FORMAT
|
||||||
@ -429,7 +429,7 @@ type LogConfig struct {
|
|||||||
// @Description the destination of access log
|
// @Description the destination of access log
|
||||||
// the key is log adapter and the value is adapter's configure
|
// the key is log adapter and the value is adapter's configure
|
||||||
// @Default "console" => ""
|
// @Default "console" => ""
|
||||||
Outputs map[string]string // Store Adaptor : config
|
Outputs map[string]string // Store Adaptor : config
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@ -247,7 +247,7 @@ func (c *Controller) URLMapping() {}
|
|||||||
func (c *Controller) Bind(obj interface{}) error {
|
func (c *Controller) Bind(obj interface{}) error {
|
||||||
ct, exist := c.Ctx.Request.Header["Content-Type"]
|
ct, exist := c.Ctx.Request.Header["Content-Type"]
|
||||||
if !exist || len(ct) == 0 {
|
if !exist || len(ct) == 0 {
|
||||||
return c.BindJson(obj)
|
return c.BindJSON(obj)
|
||||||
}
|
}
|
||||||
i, l := 0, len(ct[0])
|
i, l := 0, len(ct[0])
|
||||||
for i < l && ct[0][i] != ';' {
|
for i < l && ct[0][i] != ';' {
|
||||||
@ -255,7 +255,7 @@ func (c *Controller) Bind(obj interface{}) error {
|
|||||||
}
|
}
|
||||||
switch ct[0][0:i] {
|
switch ct[0][0:i] {
|
||||||
case "application/json":
|
case "application/json":
|
||||||
return c.BindJson(obj)
|
return c.BindJSON(obj)
|
||||||
case "application/xml", "text/xml":
|
case "application/xml", "text/xml":
|
||||||
return c.BindXML(obj)
|
return c.BindXML(obj)
|
||||||
case "application/x-www-form-urlencoded":
|
case "application/x-www-form-urlencoded":
|
||||||
@ -277,7 +277,7 @@ func (c *Controller) BindForm(obj interface{}) error {
|
|||||||
return c.ParseForm(obj)
|
return c.ParseForm(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) BindJson(obj interface{}) error {
|
func (c *Controller) BindJSON(obj interface{}) error {
|
||||||
return json.Unmarshal(c.Ctx.Input.RequestBody, obj)
|
return json.Unmarshal(c.Ctx.Input.RequestBody, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,12 +439,12 @@ func (c *Controller) URLFor(endpoint string, values ...interface{}) string {
|
|||||||
return URLFor(endpoint, values...)
|
return URLFor(endpoint, values...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) JsonResp(data interface{}) error {
|
func (c *Controller) JSONResp(data interface{}) error {
|
||||||
c.Data["json"]=data
|
c.Data["json"] = data
|
||||||
return c.ServeJSON()
|
return c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Controller) XmlResp(data interface{}) error {
|
func (c *Controller) XMLResp(data interface{}) error {
|
||||||
c.Data["xml"] = data
|
c.Data["xml"] = data
|
||||||
return c.ServeXML()
|
return c.ServeXML()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ type FilterChain func(next FilterFunc) FilterFunc
|
|||||||
// FilterFunc defines a filter function which is invoked before the controller handler is executed.
|
// FilterFunc defines a filter function which is invoked before the controller handler is executed.
|
||||||
// It's a alias of HandleFunc
|
// It's a alias of HandleFunc
|
||||||
// In fact, the HandleFunc is the last Filter. This is the truth
|
// In fact, the HandleFunc is the last Filter. This is the truth
|
||||||
type FilterFunc=HandleFunc
|
type FilterFunc = HandleFunc
|
||||||
|
|
||||||
// FilterRouter defines a filter operation which is invoked before the controller handler is executed.
|
// FilterRouter defines a filter operation which is invoked before the controller handler is executed.
|
||||||
// It can match the URL against a pattern, and execute a filter function
|
// It can match the URL against a pattern, and execute a filter function
|
||||||
|
|||||||
@ -619,7 +619,7 @@ func (app *HttpServer) CtrlAny(rootpath string, f interface{}) *HttpServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get see HttpServer.Get
|
// Get see HttpServer.Get
|
||||||
func Get(rootpath string, f FilterFunc) *HttpServer {
|
func Get(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Get(rootpath, f)
|
return BeeApp.Get(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,13 +628,13 @@ func Get(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Get("/", func(ctx *context.Context){
|
// beego.Get("/", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
func (app *HttpServer) Get(rootpath string, f FilterFunc) *HttpServer {
|
func (app *HttpServer) Get(rootpath string, f HandleFunc) *HttpServer {
|
||||||
app.Handlers.Get(rootpath, f)
|
app.Handlers.Get(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post see HttpServer.Post
|
// Post see HttpServer.Post
|
||||||
func Post(rootpath string, f FilterFunc) *HttpServer {
|
func Post(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Post(rootpath, f)
|
return BeeApp.Post(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,13 +643,13 @@ func Post(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Post("/api", func(ctx *context.Context){
|
// beego.Post("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
func (app *HttpServer) Post(rootpath string, f FilterFunc) *HttpServer {
|
func (app *HttpServer) Post(rootpath string, f HandleFunc) *HttpServer {
|
||||||
app.Handlers.Post(rootpath, f)
|
app.Handlers.Post(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete see HttpServer.Delete
|
// Delete see HttpServer.Delete
|
||||||
func Delete(rootpath string, f FilterFunc) *HttpServer {
|
func Delete(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Delete(rootpath, f)
|
return BeeApp.Delete(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,13 +658,13 @@ func Delete(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Delete("/api", func(ctx *context.Context){
|
// beego.Delete("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
func (app *HttpServer) Delete(rootpath string, f FilterFunc) *HttpServer {
|
func (app *HttpServer) Delete(rootpath string, f HandleFunc) *HttpServer {
|
||||||
app.Handlers.Delete(rootpath, f)
|
app.Handlers.Delete(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put see HttpServer.Put
|
// Put see HttpServer.Put
|
||||||
func Put(rootpath string, f FilterFunc) *HttpServer {
|
func Put(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Put(rootpath, f)
|
return BeeApp.Put(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,13 +673,13 @@ func Put(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Put("/api", func(ctx *context.Context){
|
// beego.Put("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
func (app *HttpServer) Put(rootpath string, f FilterFunc) *HttpServer {
|
func (app *HttpServer) Put(rootpath string, f HandleFunc) *HttpServer {
|
||||||
app.Handlers.Put(rootpath, f)
|
app.Handlers.Put(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Head see HttpServer.Head
|
// Head see HttpServer.Head
|
||||||
func Head(rootpath string, f FilterFunc) *HttpServer {
|
func Head(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Head(rootpath, f)
|
return BeeApp.Head(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,13 +688,13 @@ func Head(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Head("/api", func(ctx *context.Context){
|
// beego.Head("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
func (app *HttpServer) Head(rootpath string, f FilterFunc) *HttpServer {
|
func (app *HttpServer) Head(rootpath string, f HandleFunc) *HttpServer {
|
||||||
app.Handlers.Head(rootpath, f)
|
app.Handlers.Head(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Options see HttpServer.Options
|
// Options see HttpServer.Options
|
||||||
func Options(rootpath string, f FilterFunc) *HttpServer {
|
func Options(rootpath string, f HandleFunc) *HttpServer {
|
||||||
BeeApp.Handlers.Options(rootpath, f)
|
BeeApp.Handlers.Options(rootpath, f)
|
||||||
return BeeApp
|
return BeeApp
|
||||||
}
|
}
|
||||||
@ -704,13 +704,13 @@ func Options(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Options("/api", func(ctx *context.Context){
|
// beego.Options("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
func (app *HttpServer) Options(rootpath string, f FilterFunc) *HttpServer {
|
func (app *HttpServer) Options(rootpath string, f HandleFunc) *HttpServer {
|
||||||
app.Handlers.Options(rootpath, f)
|
app.Handlers.Options(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patch see HttpServer.Patch
|
// Patch see HttpServer.Patch
|
||||||
func Patch(rootpath string, f FilterFunc) *HttpServer {
|
func Patch(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Patch(rootpath, f)
|
return BeeApp.Patch(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,13 +719,13 @@ func Patch(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Patch("/api", func(ctx *context.Context){
|
// beego.Patch("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
func (app *HttpServer) Patch(rootpath string, f FilterFunc) *HttpServer {
|
func (app *HttpServer) Patch(rootpath string, f HandleFunc) *HttpServer {
|
||||||
app.Handlers.Patch(rootpath, f)
|
app.Handlers.Patch(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any see HttpServer.Any
|
// Any see HttpServer.Any
|
||||||
func Any(rootpath string, f FilterFunc) *HttpServer {
|
func Any(rootpath string, f HandleFunc) *HttpServer {
|
||||||
return BeeApp.Any(rootpath, f)
|
return BeeApp.Any(rootpath, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ func Any(rootpath string, f FilterFunc) *HttpServer {
|
|||||||
// beego.Any("/api", func(ctx *context.Context){
|
// beego.Any("/api", func(ctx *context.Context){
|
||||||
// ctx.Output.Body("hello world")
|
// ctx.Output.Body("hello world")
|
||||||
// })
|
// })
|
||||||
func (app *HttpServer) Any(rootpath string, f FilterFunc) *HttpServer {
|
func (app *HttpServer) Any(rootpath string, f HandleFunc) *HttpServer {
|
||||||
app.Handlers.Any(rootpath, f)
|
app.Handlers.Any(rootpath, f)
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user