Beego Conf configuration file parsing

Beego default system configuration for the conf folder app.conf file; then app.conf inside the specific configuration attributes are what is meant, then one by one to explain:

beege program defaults app.conf

Beego Conf configuration file parsing

App.conf reads the configuration content in the program may be used beego:
beego.AppConfig.String("appname")

app.conf system configuration content

AppName
application name, the default is beego. Created by bee new project name is created.
beego.BConfig.AppName = "beego"

RunMode
applications operating mode is selectable prod, dev or Test. Dev default, mode of development, in the development model error prompts friendly error page, as described above in the description of the error.
beego.BConfig.RunMode = "dev"

RouterCaseSensitive
whether routing ignore case match, the default is true, case sensitive
beego.BConfig.RouterCaseSensitive = true

ServerName
beego default output server to server beego at the time of the request.
beego.BConfig.ServerName = "beego"

RecoverPanic
is abnormal recovery, the default value is true, which occurs when abnormal application, resume back through the recover, but will not cause the application to quit unexpectedly.
beego.BConfig.RecoverPanic = true

CopyRequestBody
whether to allow HTTP request, returns the original body of data bytes requested, the default is true (except GET or HEAD or upload request).
beego.BConfig.CopyRequestBody = false

EnableGzip
whether to open gzip support, default is false does not support gzip, gzip once opened, then the contents of the template output will be gzip or zlib compression to determine the user's Accept-Encoding.
beego.BConfig.EnableGzip = false
Gzip allows users to customize the level of compression, compressed length threshold and a request for a compression type:
1. Compression level, gzipCompressLevel = 9, range 1 to 9, if not set to 1 (fastest compression)
for a compression length threshold, gzipMinLength = 256, only when the length of the original content opened compression greater than this threshold, default 20B (ngnix default length)
3. The request type, includedMethods = get; post, which request type for compressing, by default only GET requests for compression

MaxMemory
file upload default memory cache size, the default is 1 << 26 (64M).
beego.BConfig.MaxMemory = 1 &lt;&lt; 26

EnableErrorsShow
is indicating a system error message, the default is true.
beego.BConfig.EnableErrorsShow = true

EnableErrorsRender
whether the error message rendering, the default value is true, that is wrong will prompt friendly error page for the API types of applications may need to set this option to false to prevent unnecessary in dev mode template rendering information return.

app.conf web configuration section

AutoRender
whether template automatic rendering, the default value is true, the type of application for the API, the application needs this option is set to false, no rendering template.
beego.BConfig.WebConfig.AutoRender = true

EnableDocs
whether to open the document built-in functions, the default is false
beego.BConfig.WebConfig.EnableDocs = true

FlashName
when Flash Cookie data set name, the default is BEEGO_FLASH
beego.BConfig.WebConfig.FlashName = "BEEGO_FLASH"

FlashSeperator
delimiter Flash data, the default is BEEGOFLASH
beego.BConfig.WebConfig.FlashSeperator = "BEEGOFLASH"

DirectoryIndex
whether to open a static directory list shows the default does not display the directory returns a 403 error.
beego.BConfig.WebConfig.DirectoryIndex = false

StaticDir
static files directory is set, the default is static
configurable single or multiple directories:
. A single directory, StaticDir = download corresponds beego.SetStaticPath ( "/ download", " download")
a plurality of directories, StaticDir = download: down download2: down2. corresponds beego.SetStaticPath ( "/ download", " down") and

beego.SetStaticPath("/download2","down2")<br/>beego.BConfig.WebConfig.StaticDir

StaticExtensionsToGzip
which static file name suffix allows for gzip compression, default support .css and .js
beego.BConfig.WebConfig.StaticExtensionsToGzip = []string{".css", ".js"}
equivalent config file
StaticExtensionsToGzip = .css, .js

TemplateLeft
template left the label, the default is {{.
beego.BConfig.WebConfig.TemplateLeft = "{{"

TemplateRight
template the right label, the default is}}.
beego.BConfig.WebConfig.TemplateRight="}}"

ViewsPath
template path, the default is views.
beego.BConfig.WebConfig.ViewsPath="views"

EnableXSRF
whether to open XSRF, default is false, do not open.
beego.BConfig.WebConfig.EnableXSRF = false

XSRFKEY
Key information XSRF, the default value is beegoxsrf. EnableXSRF = true to be effective
beego.BConfig.WebConfig.XSRFKEY = "beegoxsrf"

XSRFExpire
XSRF expiration time, the default value is 0, but period.
beego.BConfig.WebConfig.XSRFExpire = 0

Monitor configuration

Graceful
whether to open the hot upgrade, the default is false, turn off the heat to upgrade.
beego.BConfig.Listen.Graceful=false

ServerTimeOut
set HTTP timeout, the default is 0, no timeout.
beego.BConfig.Listen.ServerTimeOut=0

ListenTCP4
monitor local network address type, the default is "tcp4", the value can be "tcp", one of "unixpacket" "tcp4", " tcp6", "unix" or.
beego.BConfig.Listen.ListenTCP4 = "tcp4"

EnableHTTP
whether to enable HTTP listener, the default is true.
beego.BConfig.Listen.EnableHTTP = true

HTTPAddr
application listen address, empty by default, listens on all network card IP.
beego.BConfig.Listen.HTTPAddr = ""

HTTPPort
application listening port, default to 8080
beego.BConfig.Listen.HTTPPort = 8080

EnableHTTPS
whether to enable HTTPS, the default is false closed. When the need to enable, to set EnableHTTPS = true, and set HTTPSCertFile and HTTPSKeyFile
beego.BConfig.Listen.EnableHTTPS = false

HTTPSAddr
application listen address, empty by default, listens on all network card IP.
beego.BConfig.Listen.HTTPSAddr = ""

HTTPSPort
application listening port, default is 10443
beego.BConfig.Listen.HTTPSPort = 10443

HTTPSCertFile
When you turn on HTTPS, ssl certification path, the default is empty.
beego.BConfig.Listen.HTTPSCertFile = "conf/ssl.crt"

HTTPSKeyFile
after turning HTTPS, SSL certificate keyfile path.
beego.BConfig.Listen.HTTPSKeyFile = "conf/ssl.key"

EnableAdmin
whether to open an in-process monitoring module, default false closed.
beego.BConfig.Listen.EnableAdmin = false

AdminAddr
monitor monitor address, the default value is localhost.
beego.BConfig.Listen.AdminAddr = "localhost"

AdminPort
monitor monitor address, the default value is 8088.
beego.BConfig.Listen.AdminPort = 8088

EnableFcgi
whether to enable fastcgi, the default is false.
beego.BConfig.Listen.EnableFcgi = false

EnableStdIo
by fastcgi standard I / O, not take effect until enabled fastcgi, default false.
beego.BConfig.Listen.EnableStdIo = false

Session Configuration

SessionOn
whether the session opened, the default is false.
beego.BConfig.WebConfig.Session.SessionOn = false

SessionProvider
session of the engine, the default is memory, see the session module in detail.
beego.BConfig.WebConfig.Session.SessionProvider = ""

SessionName
presence cookie name of the client, the default value is beegosessionID.
beego.BConfig.WebConfig.Session.SessionName = "beegosessionID"

SessionGCMaxLifetime
the session expiration time, the default value is 3600 seconds.
beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 3600

SessionProviderConfig
configuration information, set different depending on the engine configuration information, see the following detailed configuration of the engine settings, see the detailed session module

SessionCookieLifeTime
the session cookie default time of existence of the client, the default value is 3600 seconds.
beego.BConfig.WebConfig.Session.SessionCookieLifeTime = 3600

SessionAutoSetCookie
whether to open SetCookie, the default value of true open.
beego.BConfig.WebConfig.Session.SessionAutoSetCookie = true

SessionDomain
the session to store the cookie domain name, default empty.
beego.BConfig.WebConfig.Session.SessionDomain = ""

Log Configuration

AccessLogs
whether to output logs to the Log, the default output will not log in prod mode, the default is false does not output log. This parameter is not supported by the configuration file configuration.
beego.BConfig.Log.AccessLogs = false

FileLineNum
whether to display the output log file name and line number in the log inside, default true. This parameter is not supported by the configuration file configuration.
beego.BConfig.Log.FileLineNum = true

Outputs
log output configuration, the reference logs module, console file and other configuration, this parameter is not supported profile configuration.
beego.BConfig.Log.Outputs = map[string]string{"console": ""}
or
beego.BConfig.Log.Outputs["console"] = ""

Guess you like

Origin blog.51cto.com/1345992/2425826