May 15, 2021 Revel
app.conf
a profile of the Revel program that uses
the goconfig syntax,
similar to Microsoft's INI file.
Here's an example:
app.name=chat
app.secret=pJLzyoiDe17L36mytqC912j81PfTiolHm1veQK6Grn1En3YFdB5lvEHVTwFEaWvj
http.addr=
http.port=9000
[dev]
results.pretty=true
watch=true
log.trace.output = off
log.info.output = stderr
log.warn.output = stderr
log.error.output = stderr
[prod]
results.pretty=false
watch=false
log.trace.output = off
log.info.output = off
log.warn.output = %(app.name)s.log
log.error.output = %(app.name)s.log
Each segment is a
run mode.
T
he top key (not in any segment) is valid for all operating modes. T
his allows the default values to apply in all modes and are override as needed.
[prod]
only used in
生产
mode.
Dev and prod modes are defined by default in the new Revel program, and you can also customize the segments you need. When the program starts, select the run mode based on the parameters provided by the (command line tool) "revel run".
Developers can customize keys and
revel.Config
access them.
Here are some simple
apis.
Application name for console output and development of web pages.
For example:
app.name = Booking example application
Default: No value
Keys are used for password operations (
revel.Sign
)。 R
evel uses it internally to sign session cookies.
Setting to empty disables the signature.
When you create a new project with
revel new
it is set to a random string.
For example:
app.secret = pJLzyoiDe17L36mytqC912j81PfTiolHm1veQK6Grn1En3YFdB5lvEHVTwFEaWvj
Default: No value
The listening port
For example:
http.port = 9000
Listen to the ip address
In Linux, an empty string represents a wildcard - in Windows, an empty string is converted
"localhost"
Default: ""
Specifies the port for the application to listen on, when run by the harness. F
or example, when the harness is running, it will listen on
http.port
, run the application on
harness.port
, and reverse-proxy requests.
Without the harness, the application listens on
http.port
directly.
By default, a random free port is selected. T his is only necessary by the program to restrict socket access to the environment when the runtime settings. B y default, a random free port will be chosen. This is only necessary to set when running in an environment that restricts socket access by the program.
Default: 0
If true, the Revel Web server will configure itself to accept SSL connections. This requires an X509 certificate and a key file.
Default: false
Specify the path to the X509 certificate file
Default: ""
Specifies the path to the X509 certificate key
Default: ""
Determines whether block encoding is used when the template is rendered. Block encoding reduces the time it takes to send the first byte to the client (before the entire template has fully rendered the data).
Default: false
Configure
RenderXml
RenderJson
XML/JSON in indentation formats.
For example:
results.pretty = true
Default: false
Specify the default language for message translation if the client requests a language that is not confirmed. If not specified, a virtual message is returned.
For example:
i18n.default_language = en
Default: ""
Specify the name of the cookie that stores the user's locale
Default: "% (cookie.prefix) _LANG" (reference cookie.prefix)
Revel monitors project changes and supports hot overloading of several types of files. Enable monitoring:
watch = true
If false, disable monitoring, and ignore other related monitoring configuration
watch.*
Default: true
If true, Revel monitors template changes and reloads them if necessary.
Default: true
If true, Revel monitors for
routes
file and reloads if necessary.
Default: true
If true, Revel monitors Go code churn and recompiles the code if necessary (running as a reverse proxy).
The code under the
app/
(including subdirectdirecters) is monitored.
Default: true
The Revel component uses the following cookies by default:
Revel uses this property as a prefix for Revel-produced cookies. This allows multiple REVEL applications to run on the same host.
For example
cookie.prefix = MY
The corresponding cookie name is as follows:
Default: "REVEL"
Revel uses this property to set the expiration date of the session cookie. R evel parses strings using ParseDuration, with a default value of 30 days. I t can also be set to expire at the end of the session. Note that the behavior of the client depends on the browser's settings, so the results are not always guaranteed.
Specify the left and right separators of the template
The separator "Left separator, right separator" must be specified in this way.
Default: ""
Specify the default date format, and Revel uses it in two places:
time.Time
(refer to
binding
)
date
output the date in the template (refer to the template
function).
)
Default: "2006-01-02"
Specify the default date-time format, and Revel uses it in two places:
time.Time
(refer to
binding
)
datetime
output dates in templates (refer to
template functions).
)
Default: "2006-01-02 15:04"
Specifies the database/sql driver import path for the DB module.
Default: ""
Specify the database/sql driver name (in
sql.Open
to use).
Default: ""
Specify the database/sql data source name (in
sql.Open
to use).
Default: ""
Build tags are used when building programs.
Default: ""
Todo
The cache module is a simple heap or distributed cache interface
Set the cache expiration time. T
he caller in the program uses the constant
cache.DEFAULT
gets.
It is to accept
time.ParseDuration
string.
(The default value cannot be specified as FOREVER at this
FOREVER
)
Default: "1h" (1 hour)
If true, the cache module uses memcached instead of the memory cache.
Default: false
A comma separates the memcached host list. C ache entries are automatically shrapned into available hosts using a determined host name cache key. Hosts may be listed multiple times to increase shared cache space.
Default: ""
The Scheduled Tasks module allows you to run scheduled or temporary tasks
Timesheets can be configured with keys.
cron.schedulename = @hourly
The schedule's schedule schedule time can be used when submitting tasks in the executor. For example:
jobs.Schedule("cron.schedulename", job)
The number of tasks allowed at the same time. For example:
jobs.pool = 4
If it is 0, there is no quantity limit
Default: 10
If true, allows a task to run, even if the instance of the task is still in the process.
Default: false
The module adds the module to the application by specifying the import path. For example:
module.testrunner = github.com/revel/revel/modules/testrunner