mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
add json tag for configuration struct for package gdb/gredis/ghttp/glog/gview
This commit is contained in:
parent
2ae32ed2c2
commit
a9aa021914
@ -27,30 +27,30 @@ type ConfigGroup []ConfigNode
|
|||||||
|
|
||||||
// ConfigNode is configuration for one node.
|
// ConfigNode is configuration for one node.
|
||||||
type ConfigNode struct {
|
type ConfigNode struct {
|
||||||
Host string // Host of server, ip or domain like: 127.0.0.1, localhost
|
Host string `json:"host"` // Host of server, ip or domain like: 127.0.0.1, localhost
|
||||||
Port string // Port, it's commonly 3306.
|
Port string `json:"port"` // Port, it's commonly 3306.
|
||||||
User string // Authentication username.
|
User string `json:"user"` // Authentication username.
|
||||||
Pass string // Authentication password.
|
Pass string `json:"pass"` // Authentication password.
|
||||||
Name string // Default used database name.
|
Name string `json:"name"` // Default used database name.
|
||||||
Type string // Database type: mysql, sqlite, mssql, pgsql, oracle.
|
Type string `json:"type"` // Database type: mysql, sqlite, mssql, pgsql, oracle.
|
||||||
Role string // (Optional, "master" in default) Node role, used for master-slave mode: master, slave.
|
Role string `json:"role"` // (Optional, "master" in default) Node role, used for master-slave mode: master, slave.
|
||||||
Debug bool // (Optional) Debug mode enables debug information logging and output.
|
Debug bool `json:"debug"` // (Optional) Debug mode enables debug information logging and output.
|
||||||
Prefix string // (Optional) Table prefix.
|
Prefix string `json:"prefix"` // (Optional) Table prefix.
|
||||||
DryRun bool // (Optional) Dry run, which does SELECT but no INSERT/UPDATE/DELETE statements.
|
DryRun bool `json:"dryRun"` // (Optional) Dry run, which does SELECT but no INSERT/UPDATE/DELETE statements.
|
||||||
Weight int // (Optional) Weight for load balance calculating, it's useless if there's just one node.
|
Weight int `json:"weight"` // (Optional) Weight for load balance calculating, it's useless if there's just one node.
|
||||||
Charset string // (Optional, "utf8mb4" in default) Custom charset when operating on database.
|
Charset string `json:"charset"` // (Optional, "utf8mb4" in default) Custom charset when operating on database.
|
||||||
LinkInfo string `json:"link"` // (Optional) Custom link information, when it is used, configuration Host/Port/User/Pass/Name are ignored.
|
LinkInfo string `json:"link"` // (Optional) Custom link information, when it is used, configuration Host/Port/User/Pass/Name are ignored.
|
||||||
MaxIdleConnCount int `json:"maxidle"` // (Optional) Max idle connection configuration for underlying connection pool.
|
MaxIdleConnCount int `json:"maxIdle"` // (Optional) Max idle connection configuration for underlying connection pool.
|
||||||
MaxOpenConnCount int `json:"maxopen"` // (Optional) Max open connection configuration for underlying connection pool.
|
MaxOpenConnCount int `json:"maxOpen"` // (Optional) Max open connection configuration for underlying connection pool.
|
||||||
MaxConnLifetime time.Duration `json:"maxlifetime"` // (Optional) Max connection TTL configuration for underlying connection pool.
|
MaxConnLifetime time.Duration `json:"maxLifetime"` // (Optional) Max connection TTL configuration for underlying connection pool.
|
||||||
QueryTimeout time.Duration // (Optional) Max query time for per dql.
|
QueryTimeout time.Duration `json:"queryTimeout"` // (Optional) Max query time for per dql.
|
||||||
ExecTimeout time.Duration // (Optional) Max exec time for dml.
|
ExecTimeout time.Duration `json:"execTimeout"` // (Optional) Max exec time for dml.
|
||||||
TranTimeout time.Duration // (Optional) Max exec time time for a transaction.
|
TranTimeout time.Duration `json:"tranTimeout"` // (Optional) Max exec time time for a transaction.
|
||||||
PrepareTimeout time.Duration // (Optional) Max exec time time for prepare operation.
|
PrepareTimeout time.Duration `json:"prepareTimeout"` // (Optional) Max exec time time for prepare operation.
|
||||||
CreatedAt string // (Optional) The filed name of table for automatic-filled created datetime.
|
CreatedAt string `json:"createdAt"` // (Optional) The filed name of table for automatic-filled created datetime.
|
||||||
UpdatedAt string // (Optional) The filed name of table for automatic-filled updated datetime.
|
UpdatedAt string `json:"updatedAt"` // (Optional) The filed name of table for automatic-filled updated datetime.
|
||||||
DeletedAt string // (Optional) The filed name of table for automatic-filled updated datetime.
|
DeletedAt string `json:"deletedAt"` // (Optional) The filed name of table for automatic-filled updated datetime.
|
||||||
TimeMaintainDisabled bool // (Optional) Disable the automatic time maintaining feature.
|
TimeMaintainDisabled bool `json:"timeMaintainDisabled"` // (Optional) Disable the automatic time maintaining feature.
|
||||||
}
|
}
|
||||||
|
|
||||||
// configs is internal used configuration object.
|
// configs is internal used configuration object.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the MIT License.
|
// This Source Code Form is subject to the terms of the MIT License.
|
||||||
// If a copy of the MIT was not distributed with this file,
|
// If a copy of the MIT was not distributed with this file,
|
||||||
@ -36,17 +36,17 @@ type Conn struct {
|
|||||||
|
|
||||||
// Redis configuration.
|
// Redis configuration.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Host string
|
Host string `json:"host"`
|
||||||
Port int
|
Port int `json:"port"`
|
||||||
Db int
|
Db int `json:"db"`
|
||||||
Pass string // Password for AUTH.
|
Pass string `json:"pass"` // Password for AUTH.
|
||||||
MaxIdle int // Maximum number of connections allowed to be idle (default is 10)
|
MaxIdle int `json:"maxIdle"` // Maximum number of connections allowed to be idle (default is 10)
|
||||||
MaxActive int // Maximum number of connections limit (default is 0 means no limit).
|
MaxActive int `json:"maxActive"` // Maximum number of connections limit (default is 0 means no limit).
|
||||||
IdleTimeout time.Duration // Maximum idle time for connection (default is 10 seconds, not allowed to be set to 0)
|
IdleTimeout time.Duration `json:"idleTimeout"` // Maximum idle time for connection (default is 10 seconds, not allowed to be set to 0)
|
||||||
MaxConnLifetime time.Duration // Maximum lifetime of the connection (default is 30 seconds, not allowed to be set to 0)
|
MaxConnLifetime time.Duration `json:"maxConnLifetime"` // Maximum lifetime of the connection (default is 30 seconds, not allowed to be set to 0)
|
||||||
ConnectTimeout time.Duration // Dial connection timeout.
|
ConnectTimeout time.Duration `json:"connectTimeout"` // Dial connection timeout.
|
||||||
TLS bool // Specifies the config to use when a TLS connection is dialed.
|
TLS bool `json:"tls"` // Specifies the config to use when a TLS connection is dialed.
|
||||||
TLSSkipVerify bool // Disables server name verification when connecting over TLS
|
TLSSkipVerify bool `json:"tlsSkipVerify"` // Disables server name verification when connecting over TLS
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pool statistics.
|
// Pool statistics.
|
||||||
|
@ -350,7 +350,7 @@ func (s *Server) startServer(fdMap listenerFdMap) {
|
|||||||
s.config.HTTPSAddr = s.config.Address
|
s.config.HTTPSAddr = s.config.Address
|
||||||
s.config.Address = ""
|
s.config.Address = ""
|
||||||
} else {
|
} else {
|
||||||
s.config.HTTPSAddr = gDEFAULT_HTTPS_ADDR
|
s.config.HTTPSAddr = defaultHttpsAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
httpsEnabled = len(s.config.HTTPSAddr) > 0
|
httpsEnabled = len(s.config.HTTPSAddr) > 0
|
||||||
@ -385,7 +385,7 @@ func (s *Server) startServer(fdMap listenerFdMap) {
|
|||||||
}
|
}
|
||||||
// HTTP
|
// HTTP
|
||||||
if !httpsEnabled && len(s.config.Address) == 0 {
|
if !httpsEnabled && len(s.config.Address) == 0 {
|
||||||
s.config.Address = gDEFAULT_HTTP_ADDR
|
s.config.Address = defaultHttpAddr
|
||||||
}
|
}
|
||||||
var array []string
|
var array []string
|
||||||
if v, ok := fdMap["http"]; ok && len(v) > 0 {
|
if v, ok := fdMap["http"]; ok && len(v) > 0 {
|
||||||
|
@ -27,12 +27,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
gDEFAULT_HTTP_ADDR = ":80" // Default listening port for HTTP.
|
defaultHttpAddr = ":80" // Default listening port for HTTP.
|
||||||
gDEFAULT_HTTPS_ADDR = ":443" // Default listening port for HTTPS.
|
defaultHttpsAddr = ":443" // Default listening port for HTTPS.
|
||||||
URI_TYPE_DEFAULT = 0 // Method name to URI converting type, which converts name to its lower case and joins the words using char '-'.
|
URI_TYPE_DEFAULT = 0 // Method name to URI converting type, which converts name to its lower case and joins the words using char '-'.
|
||||||
URI_TYPE_FULLNAME = 1 // Method name to URI converting type, which does no converting to the method name.
|
URI_TYPE_FULLNAME = 1 // Method name to URI converting type, which does no converting to the method name.
|
||||||
URI_TYPE_ALLLOWER = 2 // Method name to URI converting type, which converts name to its lower case.
|
URI_TYPE_ALLLOWER = 2 // Method name to URI converting type, which converts name to its lower case.
|
||||||
URI_TYPE_CAMEL = 3 // Method name to URI converting type, which converts name to its camel case.
|
URI_TYPE_CAMEL = 3 // Method name to URI converting type, which converts name to its camel case.
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServerConfig is the HTTP Server configuration manager.
|
// ServerConfig is the HTTP Server configuration manager.
|
||||||
@ -43,16 +43,16 @@ type ServerConfig struct {
|
|||||||
|
|
||||||
// Address specifies the server listening address like "port" or ":port",
|
// Address specifies the server listening address like "port" or ":port",
|
||||||
// multiple addresses joined using ','.
|
// multiple addresses joined using ','.
|
||||||
Address string
|
Address string `json:"address"`
|
||||||
|
|
||||||
// HTTPSAddr specifies the HTTPS addresses, multiple addresses joined using char ','.
|
// HTTPSAddr specifies the HTTPS addresses, multiple addresses joined using char ','.
|
||||||
HTTPSAddr string
|
HTTPSAddr string `json:"httpsAddr"`
|
||||||
|
|
||||||
// HTTPSCertPath specifies certification file path for HTTPS service.
|
// HTTPSCertPath specifies certification file path for HTTPS service.
|
||||||
HTTPSCertPath string
|
HTTPSCertPath string `json:"httpsCertPath"`
|
||||||
|
|
||||||
// HTTPSKeyPath specifies the key file path for HTTPS service.
|
// HTTPSKeyPath specifies the key file path for HTTPS service.
|
||||||
HTTPSKeyPath string
|
HTTPSKeyPath string `json:"httpsKeyPath"`
|
||||||
|
|
||||||
// TLSConfig optionally provides a TLS configuration for use
|
// TLSConfig optionally provides a TLS configuration for use
|
||||||
// by ServeTLS and ListenAndServeTLS. Note that this value is
|
// by ServeTLS and ListenAndServeTLS. Note that this value is
|
||||||
@ -61,10 +61,10 @@ type ServerConfig struct {
|
|||||||
// tls.Config.SetSessionTicketKeys. To use
|
// tls.Config.SetSessionTicketKeys. To use
|
||||||
// SetSessionTicketKeys, use Server.Serve with a TLS Listener
|
// SetSessionTicketKeys, use Server.Serve with a TLS Listener
|
||||||
// instead.
|
// instead.
|
||||||
TLSConfig *tls.Config
|
TLSConfig *tls.Config `json:"tlsConfig"`
|
||||||
|
|
||||||
// Handler the handler for HTTP request.
|
// Handler the handler for HTTP request.
|
||||||
Handler http.Handler
|
Handler http.Handler `json:"-"`
|
||||||
|
|
||||||
// ReadTimeout is the maximum duration for reading the entire
|
// ReadTimeout is the maximum duration for reading the entire
|
||||||
// request, including the body.
|
// request, including the body.
|
||||||
@ -73,19 +73,19 @@ type ServerConfig struct {
|
|||||||
// decisions on each request body's acceptable deadline or
|
// decisions on each request body's acceptable deadline or
|
||||||
// upload rate, most users will prefer to use
|
// upload rate, most users will prefer to use
|
||||||
// ReadHeaderTimeout. It is valid to use them both.
|
// ReadHeaderTimeout. It is valid to use them both.
|
||||||
ReadTimeout time.Duration
|
ReadTimeout time.Duration `json:"readTimeout"`
|
||||||
|
|
||||||
// WriteTimeout is the maximum duration before timing out
|
// WriteTimeout is the maximum duration before timing out
|
||||||
// writes of the response. It is reset whenever a new
|
// writes of the response. It is reset whenever a new
|
||||||
// request's header is read. Like ReadTimeout, it does not
|
// request's header is read. Like ReadTimeout, it does not
|
||||||
// let Handlers make decisions on a per-request basis.
|
// let Handlers make decisions on a per-request basis.
|
||||||
WriteTimeout time.Duration
|
WriteTimeout time.Duration `json:"writeTimeout"`
|
||||||
|
|
||||||
// IdleTimeout is the maximum amount of time to wait for the
|
// IdleTimeout is the maximum amount of time to wait for the
|
||||||
// next request when keep-alives are enabled. If IdleTimeout
|
// next request when keep-alives are enabled. If IdleTimeout
|
||||||
// is zero, the value of ReadTimeout is used. If both are
|
// is zero, the value of ReadTimeout is used. If both are
|
||||||
// zero, there is no timeout.
|
// zero, there is no timeout.
|
||||||
IdleTimeout time.Duration
|
IdleTimeout time.Duration `json:"idleTimeout"`
|
||||||
|
|
||||||
// MaxHeaderBytes controls the maximum number of bytes the
|
// MaxHeaderBytes controls the maximum number of bytes the
|
||||||
// server will read parsing the request header's keys and
|
// server will read parsing the request header's keys and
|
||||||
@ -94,102 +94,102 @@ type ServerConfig struct {
|
|||||||
//
|
//
|
||||||
// It can be configured in configuration file using string like: 1m, 10m, 500kb etc.
|
// It can be configured in configuration file using string like: 1m, 10m, 500kb etc.
|
||||||
// It's 10240 bytes in default.
|
// It's 10240 bytes in default.
|
||||||
MaxHeaderBytes int
|
MaxHeaderBytes int `json:"maxHeaderBytes"`
|
||||||
|
|
||||||
// KeepAlive enables HTTP keep-alive.
|
// KeepAlive enables HTTP keep-alive.
|
||||||
KeepAlive bool
|
KeepAlive bool `json:"keepAlive"`
|
||||||
|
|
||||||
// ServerAgent specifies the server agent information, which is wrote to
|
// ServerAgent specifies the server agent information, which is wrote to
|
||||||
// HTTP response header as "Server".
|
// HTTP response header as "Server".
|
||||||
ServerAgent string
|
ServerAgent string `json:"serverAgent"`
|
||||||
|
|
||||||
// View specifies the default template view object for the server.
|
// View specifies the default template view object for the server.
|
||||||
View *gview.View
|
View *gview.View `json:"view"`
|
||||||
|
|
||||||
// ==================================
|
// ==================================
|
||||||
// Static.
|
// Static.
|
||||||
// ==================================
|
// ==================================
|
||||||
|
|
||||||
// Rewrites specifies the URI rewrite rules map.
|
// Rewrites specifies the URI rewrite rules map.
|
||||||
Rewrites map[string]string
|
Rewrites map[string]string `json:"rewrites"`
|
||||||
|
|
||||||
// IndexFiles specifies the index files for static folder.
|
// IndexFiles specifies the index files for static folder.
|
||||||
IndexFiles []string
|
IndexFiles []string `json:"indexFiles"`
|
||||||
|
|
||||||
// IndexFolder specifies if listing sub-files when requesting folder.
|
// IndexFolder specifies if listing sub-files when requesting folder.
|
||||||
// The server responses HTTP status code 403 if it is false.
|
// The server responses HTTP status code 403 if it is false.
|
||||||
IndexFolder bool
|
IndexFolder bool `json:"indexFolder"`
|
||||||
|
|
||||||
// ServerRoot specifies the root directory for static service.
|
// ServerRoot specifies the root directory for static service.
|
||||||
ServerRoot string
|
ServerRoot string `json:"serverRoot"`
|
||||||
|
|
||||||
// SearchPaths specifies additional searching directories for static service.
|
// SearchPaths specifies additional searching directories for static service.
|
||||||
SearchPaths []string
|
SearchPaths []string `json:"searchPaths"`
|
||||||
|
|
||||||
// StaticPaths specifies URI to directory mapping array.
|
// StaticPaths specifies URI to directory mapping array.
|
||||||
StaticPaths []staticPathItem
|
StaticPaths []staticPathItem `json:"staticPaths"`
|
||||||
|
|
||||||
// FileServerEnabled is the global switch for static service.
|
// FileServerEnabled is the global switch for static service.
|
||||||
// It is automatically set enabled if any static path is set.
|
// It is automatically set enabled if any static path is set.
|
||||||
FileServerEnabled bool
|
FileServerEnabled bool `json:"fileServerEnabled"`
|
||||||
|
|
||||||
// ==================================
|
// ==================================
|
||||||
// Cookie.
|
// Cookie.
|
||||||
// ==================================
|
// ==================================
|
||||||
|
|
||||||
// CookieMaxAge specifies the max TTL for cookie items.
|
// CookieMaxAge specifies the max TTL for cookie items.
|
||||||
CookieMaxAge time.Duration
|
CookieMaxAge time.Duration `json:"cookieMaxAge"`
|
||||||
|
|
||||||
// CookiePath specifies cookie path.
|
// CookiePath specifies cookie path.
|
||||||
// It also affects the default storage for session id.
|
// It also affects the default storage for session id.
|
||||||
CookiePath string
|
CookiePath string `json:"cookiePath"`
|
||||||
|
|
||||||
// CookieDomain specifies cookie domain.
|
// CookieDomain specifies cookie domain.
|
||||||
// It also affects the default storage for session id.
|
// It also affects the default storage for session id.
|
||||||
CookieDomain string
|
CookieDomain string `json:"cookieDomain"`
|
||||||
|
|
||||||
// ==================================
|
// ==================================
|
||||||
// Session.
|
// Session.
|
||||||
// ==================================
|
// ==================================
|
||||||
|
|
||||||
// SessionIdName specifies the session id name.
|
// SessionIdName specifies the session id name.
|
||||||
SessionIdName string
|
SessionIdName string `json:"sessionIdName"`
|
||||||
|
|
||||||
// SessionMaxAge specifies max TTL for session items.
|
// SessionMaxAge specifies max TTL for session items.
|
||||||
SessionMaxAge time.Duration
|
SessionMaxAge time.Duration `json:"sessionMaxAge"`
|
||||||
|
|
||||||
// SessionPath specifies the session storage directory path for storing session files.
|
// SessionPath specifies the session storage directory path for storing session files.
|
||||||
// It only makes sense if the session storage is type of file storage.
|
// It only makes sense if the session storage is type of file storage.
|
||||||
SessionPath string
|
SessionPath string `json:"sessionPath"`
|
||||||
|
|
||||||
// SessionStorage specifies the session storage.
|
// SessionStorage specifies the session storage.
|
||||||
SessionStorage gsession.Storage
|
SessionStorage gsession.Storage `json:"sessionStorage"`
|
||||||
|
|
||||||
// SessionCookieMaxAge specifies the cookie ttl for session id.
|
// SessionCookieMaxAge specifies the cookie ttl for session id.
|
||||||
// It it is set 0, it means it expires along with browser session.
|
// It it is set 0, it means it expires along with browser session.
|
||||||
SessionCookieMaxAge time.Duration
|
SessionCookieMaxAge time.Duration `json:"sessionCookieMaxAge"`
|
||||||
|
|
||||||
// SessionCookieOutput specifies whether automatic outputting session id to cookie.
|
// SessionCookieOutput specifies whether automatic outputting session id to cookie.
|
||||||
SessionCookieOutput bool
|
SessionCookieOutput bool `json:"sessionCookieOutput"`
|
||||||
|
|
||||||
// ==================================
|
// ==================================
|
||||||
// Logging.
|
// Logging.
|
||||||
// ==================================
|
// ==================================
|
||||||
Logger *glog.Logger // Logger specifies the logger for server.
|
Logger *glog.Logger `json:"logger"` // Logger specifies the logger for server.
|
||||||
LogPath string // LogPath specifies the directory for storing logging files.
|
LogPath string `json:"logPath"` // LogPath specifies the directory for storing logging files.
|
||||||
LogLevel string // LogLevel specifies the logging level for logger.
|
LogLevel string `json:"logLevel"` // LogLevel specifies the logging level for logger.
|
||||||
LogStdout bool // LogStdout specifies whether printing logging content to stdout.
|
LogStdout bool `json:"logStdout"` // LogStdout specifies whether printing logging content to stdout.
|
||||||
ErrorStack bool // ErrorStack specifies whether logging stack information when error.
|
ErrorStack bool `json:"errorStack"` // ErrorStack specifies whether logging stack information when error.
|
||||||
ErrorLogEnabled bool // ErrorLogEnabled enables error logging content to files.
|
ErrorLogEnabled bool `json:"errorLogEnabled"` // ErrorLogEnabled enables error logging content to files.
|
||||||
ErrorLogPattern string // ErrorLogPattern specifies the error log file pattern like: error-{Ymd}.log
|
ErrorLogPattern string `json:"errorLogPattern"` // ErrorLogPattern specifies the error log file pattern like: error-{Ymd}.log
|
||||||
AccessLogEnabled bool // AccessLogEnabled enables access logging content to files.
|
AccessLogEnabled bool `json:"accessLogEnabled"` // AccessLogEnabled enables access logging content to files.
|
||||||
AccessLogPattern string // AccessLogPattern specifies the error log file pattern like: access-{Ymd}.log
|
AccessLogPattern string `json:"accessLogPattern"` // AccessLogPattern specifies the error log file pattern like: access-{Ymd}.log
|
||||||
|
|
||||||
// ==================================
|
// ==================================
|
||||||
// PProf.
|
// PProf.
|
||||||
// ==================================
|
// ==================================
|
||||||
PProfEnabled bool // PProfEnabled enables PProf feature.
|
PProfEnabled bool `json:"pprofEnabled"` // PProfEnabled enables PProf feature.
|
||||||
PProfPattern string // PProfPattern specifies the PProf service pattern for router.
|
PProfPattern string `json:"pprofPattern"` // PProfPattern specifies the PProf service pattern for router.
|
||||||
|
|
||||||
// ==================================
|
// ==================================
|
||||||
// Other.
|
// Other.
|
||||||
@ -198,26 +198,26 @@ type ServerConfig struct {
|
|||||||
// ClientMaxBodySize specifies the max body size limit in bytes for client request.
|
// ClientMaxBodySize specifies the max body size limit in bytes for client request.
|
||||||
// It can be configured in configuration file using string like: 1m, 10m, 500kb etc.
|
// It can be configured in configuration file using string like: 1m, 10m, 500kb etc.
|
||||||
// It's 8MB in default.
|
// It's 8MB in default.
|
||||||
ClientMaxBodySize int64
|
ClientMaxBodySize int64 `json:"clientMaxBodySize"`
|
||||||
|
|
||||||
// FormParsingMemory specifies max memory buffer size in bytes which can be used for
|
// FormParsingMemory specifies max memory buffer size in bytes which can be used for
|
||||||
// parsing multimedia form.
|
// parsing multimedia form.
|
||||||
// It can be configured in configuration file using string like: 1m, 10m, 500kb etc.
|
// It can be configured in configuration file using string like: 1m, 10m, 500kb etc.
|
||||||
// It's 1MB in default.
|
// It's 1MB in default.
|
||||||
FormParsingMemory int64
|
FormParsingMemory int64 `json:"formParsingMemory"`
|
||||||
|
|
||||||
// NameToUriType specifies the type for converting struct method name to URI when
|
// NameToUriType specifies the type for converting struct method name to URI when
|
||||||
// registering routes.
|
// registering routes.
|
||||||
NameToUriType int
|
NameToUriType int `json:"nameToUriType"`
|
||||||
|
|
||||||
// RouteOverWrite allows overwrite the route if duplicated.
|
// RouteOverWrite allows overwrite the route if duplicated.
|
||||||
RouteOverWrite bool
|
RouteOverWrite bool `json:"routeOverWrite"`
|
||||||
|
|
||||||
// DumpRouterMap specifies whether automatically dumps router map when server starts.
|
// DumpRouterMap specifies whether automatically dumps router map when server starts.
|
||||||
DumpRouterMap bool
|
DumpRouterMap bool `json:"dumpRouterMap"`
|
||||||
|
|
||||||
// Graceful enables graceful reload feature for all servers of the process.
|
// Graceful enables graceful reload feature for all servers of the process.
|
||||||
Graceful bool
|
Graceful bool `json:"graceful"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated. Use NewConfig instead.
|
// Deprecated. Use NewConfig instead.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the MIT License.
|
// This Source Code Form is subject to the terms of the MIT License.
|
||||||
// If a copy of the MIT was not distributed with this file,
|
// If a copy of the MIT was not distributed with this file,
|
||||||
@ -21,25 +21,25 @@ import (
|
|||||||
|
|
||||||
// Config is the configuration object for logger.
|
// Config is the configuration object for logger.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Writer io.Writer // Customized io.Writer.
|
Writer io.Writer `json:"-"` // Customized io.Writer.
|
||||||
Flags int // Extra flags for logging output features.
|
Flags int `json:"flags"` // Extra flags for logging output features.
|
||||||
Path string // Logging directory path.
|
Path string `json:"path"` // Logging directory path.
|
||||||
File string // Format for logging file.
|
File string `json:"file"` // Format for logging file.
|
||||||
Level int // Output level.
|
Level int `json:"level"` // Output level.
|
||||||
Prefix string // Prefix string for every logging content.
|
Prefix string `json:"prefix"` // Prefix string for every logging content.
|
||||||
StSkip int // Skip count for stack.
|
StSkip int `json:"stSkip"` // Skip count for stack.
|
||||||
StStatus int // Stack status(1: enabled - default; 0: disabled)
|
StStatus int `json:"stStatus"` // Stack status(1: enabled - default; 0: disabled)
|
||||||
StFilter string // Stack string filter.
|
StFilter string `json:"stFilter"` // Stack string filter.
|
||||||
CtxKeys []interface{} // Context keys for logging, which is used for value retrieving from context.
|
CtxKeys []interface{} `json:"ctxKeys"` // Context keys for logging, which is used for value retrieving from context.
|
||||||
HeaderPrint bool `c:"header"` // Print header or not(true in default).
|
HeaderPrint bool `json:"header"` // Print header or not(true in default).
|
||||||
StdoutPrint bool `c:"stdout"` // Output to stdout or not(true in default).
|
StdoutPrint bool `json:"stdout"` // Output to stdout or not(true in default).
|
||||||
LevelPrefixes map[int]string // Logging level to its prefix string mapping.
|
LevelPrefixes map[int]string `json:"levelPrefixes"` // Logging level to its prefix string mapping.
|
||||||
RotateSize int64 // Rotate the logging file if its size > 0 in bytes.
|
RotateSize int64 `json:"rotateSize"` // Rotate the logging file if its size > 0 in bytes.
|
||||||
RotateExpire time.Duration // Rotate the logging file if its mtime exceeds this duration.
|
RotateExpire time.Duration `json:"rotateExpire"` // Rotate the logging file if its mtime exceeds this duration.
|
||||||
RotateBackupLimit int // Max backup for rotated files, default is 0, means no backups.
|
RotateBackupLimit int `json:"rotateBackupLimit"` // Max backup for rotated files, default is 0, means no backups.
|
||||||
RotateBackupExpire time.Duration // Max expire for rotated files, which is 0 in default, means no expiration.
|
RotateBackupExpire time.Duration `json:"rotateBackupExpire"` // Max expire for rotated files, which is 0 in default, means no expiration.
|
||||||
RotateBackupCompress int // Compress level for rotated files using gzip algorithm. It's 0 in default, means no compression.
|
RotateBackupCompress int `json:"rotateBackupCompress"` // Compress level for rotated files using gzip algorithm. It's 0 in default, means no compression.
|
||||||
RotateCheckInterval time.Duration // Asynchronizely checks the backups and expiration at intervals. It's 1 hour in default.
|
RotateCheckInterval time.Duration `json:"rotateCheckInterval"` // Asynchronizely checks the backups and expiration at intervals. It's 1 hour in default.
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultConfig returns the default configuration for logger.
|
// DefaultConfig returns the default configuration for logger.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
||||||
//
|
//
|
||||||
// This Source Code Form is subject to the terms of the MIT License.
|
// This Source Code Form is subject to the terms of the MIT License.
|
||||||
// If a copy of the MIT was not distributed with this file,
|
// If a copy of the MIT was not distributed with this file,
|
||||||
@ -21,12 +21,12 @@ import (
|
|||||||
|
|
||||||
// Config is the configuration object for template engine.
|
// Config is the configuration object for template engine.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Paths []string // Searching array for path, NOT concurrent-safe for performance purpose.
|
Paths []string `json:"paths"` // Searching array for path, NOT concurrent-safe for performance purpose.
|
||||||
Data map[string]interface{} // Global template variables including configuration.
|
Data map[string]interface{} `json:"data"` // Global template variables including configuration.
|
||||||
DefaultFile string // Default template file for parsing.
|
DefaultFile string `json:"defaultFile"` // Default template file for parsing.
|
||||||
Delimiters []string // Custom template delimiters.
|
Delimiters []string `json:"delimiters"` // Custom template delimiters.
|
||||||
AutoEncode bool // Automatically encodes and provides safe html output, which is good for avoiding XSS.
|
AutoEncode bool `json:"autoEncode"` // Automatically encodes and provides safe html output, which is good for avoiding XSS.
|
||||||
I18nManager *gi18n.Manager // I18n manager for the view.
|
I18nManager *gi18n.Manager `json:"-"` // I18n manager for the view.
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
Reference in New Issue
Block a user