2018-09-13 18:25:30 +08:00
|
|
|
/* This is a JSON format configuration file
|
2019-03-25 17:44:22 +08:00
|
|
|
*/
|
2018-09-13 18:25:30 +08:00
|
|
|
{
|
2019-03-12 18:21:35 +08:00
|
|
|
/*
|
2021-05-29 16:53:46 +08:00
|
|
|
//ssl:The global SSL settings. "key" and "cert" are the path to the SSL key and certificate. While
|
|
|
|
// "conf" is an array of 1 or 2-element tuples that supplies file style options for `SSL_CONF_cmd`.
|
2019-03-12 18:21:35 +08:00
|
|
|
"ssl": {
|
2023-03-30 23:14:53 +08:00
|
|
|
"cert": "../../trantor/trantor/tests/server.crt",
|
|
|
|
"key": "../../trantor/trantor/tests/server.key",
|
2021-05-29 16:53:46 +08:00
|
|
|
"conf": [
|
|
|
|
//["Options", "-SessionTicket"],
|
|
|
|
//["Options", "Compression"]
|
|
|
|
]
|
2018-09-13 18:25:30 +08:00
|
|
|
},
|
2019-03-12 18:21:35 +08:00
|
|
|
"listeners": [
|
|
|
|
{
|
|
|
|
//address: Ip address,0.0.0.0 by default
|
|
|
|
"address": "0.0.0.0",
|
|
|
|
//port: Port number
|
|
|
|
"port": 80,
|
|
|
|
//https: If true, use https for security,false by default
|
|
|
|
"https": false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"address": "0.0.0.0",
|
|
|
|
"port": 443,
|
|
|
|
"https": true,
|
|
|
|
//cert,key: Cert file path and key file path, empty by default,
|
2019-05-07 14:04:37 +08:00
|
|
|
//if empty, use the global setting
|
2019-03-12 18:21:35 +08:00
|
|
|
"cert": "",
|
2020-10-01 23:40:46 +08:00
|
|
|
"key": "",
|
|
|
|
//use_old_tls: enable the TLS1.0/1.1, false by default
|
2021-05-29 16:53:46 +08:00
|
|
|
"use_old_tls": false,
|
|
|
|
"ssl_conf": [
|
|
|
|
//["MinProtocol", "TLSv1.3"]
|
|
|
|
]
|
2019-03-12 18:21:35 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"db_clients": [
|
|
|
|
{
|
|
|
|
//name: Name of the client,'default' by default
|
|
|
|
//"name":"",
|
|
|
|
//rdbms: Server type, postgresql,mysql or sqlite3, "postgresql" by default
|
|
|
|
"rdbms": "postgresql",
|
|
|
|
//filename: Sqlite3 db file name
|
|
|
|
//"filename":"",
|
|
|
|
//host: Server address,localhost by default
|
|
|
|
"host": "127.0.0.1",
|
|
|
|
//port: Server port, 5432 by default
|
|
|
|
"port": 5432,
|
|
|
|
//dbname: Database name
|
|
|
|
"dbname": "test",
|
|
|
|
//user: 'postgres' by default
|
|
|
|
"user": "",
|
|
|
|
//passwd: '' by default
|
|
|
|
"passwd": "",
|
2019-03-22 15:23:55 +08:00
|
|
|
//is_fast: false by default, if it is true, the client is faster but user can't call
|
|
|
|
//any synchronous interface of it.
|
2019-03-27 13:11:02 +08:00
|
|
|
"is_fast": false,
|
2020-06-20 20:21:14 +08:00
|
|
|
//client_encoding: The character set used by the client. it is empty string by default which
|
|
|
|
//means use the default character set.
|
|
|
|
//"client_encoding": "",
|
2021-03-13 19:13:54 +08:00
|
|
|
//number_of_connections: 1 by default, if the 'is_fast' is true, the number is the number of
|
2019-07-10 17:57:47 +08:00
|
|
|
//connections per IO thread, otherwise it is the total number of all connections.
|
2021-04-29 10:13:34 +08:00
|
|
|
"number_of_connections": 1,
|
|
|
|
//timeout: -1.0 by default, in seconds, the timeout for executing a SQL query.
|
|
|
|
//zero or negative value means no timeout.
|
2022-06-05 21:10:42 +08:00
|
|
|
"timeout": -1.0,
|
|
|
|
//"auto_batch": this feature is only available for the PostgreSQL driver(version >= 14.0), see
|
|
|
|
// the wiki for more details.
|
|
|
|
"auto_batch": false
|
2021-03-13 19:13:54 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"redis_clients": [
|
|
|
|
{
|
|
|
|
//name: Name of the client,'default' by default
|
|
|
|
//"name":"",
|
|
|
|
//host: Server IP, 127.0.0.1 by default
|
|
|
|
"host": "127.0.0.1",
|
|
|
|
//port: Server port, 6379 by default
|
|
|
|
"port": 6379,
|
2022-04-30 00:48:18 +08:00
|
|
|
//username: '' by default which means 'default' in redis ACL
|
|
|
|
"username": "",
|
2021-03-13 19:13:54 +08:00
|
|
|
//passwd: '' by default
|
|
|
|
"passwd": "",
|
2021-05-12 18:32:49 +08:00
|
|
|
//db index: 0 by default
|
|
|
|
"db": 0,
|
2021-03-13 19:13:54 +08:00
|
|
|
//is_fast: false by default, if it is true, the client is faster but user can't call
|
|
|
|
//any synchronous interface of it.
|
|
|
|
"is_fast": false,
|
|
|
|
//number_of_connections: 1 by default, if the 'is_fast' is true, the number is the number of
|
|
|
|
//connections per IO thread, otherwise it is the total number of all connections.
|
2021-04-30 08:00:11 +08:00
|
|
|
"number_of_connections": 1,
|
|
|
|
//timeout: -1.0 by default, in seconds, the timeout for executing a command.
|
|
|
|
//zero or negative value means no timeout.
|
|
|
|
"timeout": -1.0
|
2019-03-12 18:21:35 +08:00
|
|
|
}
|
|
|
|
],*/
|
|
|
|
"app": {
|
2021-03-13 19:13:54 +08:00
|
|
|
//number_of_threads: The number of IO threads, 1 by default, if the value is set to 0, the number of threads
|
2019-03-31 18:30:06 +08:00
|
|
|
//is the number of CPU cores
|
2021-03-13 19:13:54 +08:00
|
|
|
"number_of_threads": 1,
|
2019-03-12 18:21:35 +08:00
|
|
|
//enable_session: False by default
|
|
|
|
"enable_session": true,
|
|
|
|
"session_timeout": 0,
|
2022-05-14 13:59:49 +08:00
|
|
|
//string value of SameSite attribute of the Set-Cookie HTTP respone header
|
|
|
|
//valid value is either 'Null' (default), 'Lax', 'Strict' or 'None'
|
|
|
|
"session_same_site" : "Null",
|
2019-03-25 17:44:22 +08:00
|
|
|
//document_root: Root path of HTTP document, defaut path is ./
|
2019-03-12 18:21:35 +08:00
|
|
|
"document_root": "./",
|
2019-05-07 23:19:26 +08:00
|
|
|
//home_page: Set the HTML file of the home page, the default value is "index.html"
|
|
|
|
//If there isn't any handler registered to the path "/", the home page file in the "document_root" is send to clients as a response
|
|
|
|
//to the request for "/".
|
|
|
|
"home_page": "index.html",
|
2020-12-11 14:02:47 +08:00
|
|
|
//use_implicit_page: enable implicit pages if true, true by default
|
|
|
|
"use_implicit_page": true,
|
|
|
|
//implicit_page: Set the file which would the server access in a directory that a user accessed.
|
|
|
|
//For example, by default, http://localhost/a-directory resolves to http://localhost/a-directory/index.html.
|
|
|
|
"implicit_page": "index.html",
|
2019-10-31 15:47:12 +08:00
|
|
|
//static_file_headers: Headers for static files
|
|
|
|
/*"static_file_headers": [
|
|
|
|
{
|
|
|
|
"name": "field-name",
|
|
|
|
"value": "field-value"
|
|
|
|
}
|
|
|
|
],*/
|
2019-03-12 18:21:35 +08:00
|
|
|
//upload_path: The path to save the uploaded file. "uploads" by default.
|
|
|
|
//If the path isn't prefixed with /, ./ or ../,
|
|
|
|
//it is relative path of document_root path
|
|
|
|
"upload_path": "uploads",
|
|
|
|
/* file_types:
|
2019-03-25 17:44:22 +08:00
|
|
|
* HTTP download file types,The file types supported by drogon
|
|
|
|
* by default are "html", "js", "css", "xml", "xsl", "txt", "svg",
|
|
|
|
* "ttf", "otf", "woff2", "woff" , "eot", "png", "jpg", "jpeg",
|
|
|
|
* "gif", "bmp", "ico", "icns", etc. */
|
2019-03-12 18:21:35 +08:00
|
|
|
"file_types": [
|
|
|
|
"gif",
|
|
|
|
"png",
|
|
|
|
"jpg",
|
|
|
|
"js",
|
|
|
|
"css",
|
|
|
|
"html",
|
|
|
|
"ico",
|
|
|
|
"swf",
|
|
|
|
"xap",
|
|
|
|
"apk",
|
|
|
|
"cur",
|
2023-04-27 15:19:33 +08:00
|
|
|
"xml",
|
|
|
|
"webp",
|
|
|
|
"svg"
|
2018-12-04 17:11:39 +08:00
|
|
|
],
|
2021-09-24 22:51:09 +08:00
|
|
|
// mime: A dictionary that extends the internal MIME type support. Maps extensions into new MIME types
|
|
|
|
// note: This option only adds MIME to the sever. `file_types` above have to be set for the server to serve them.
|
|
|
|
"mime": {
|
|
|
|
// "text/markdown": "md",
|
|
|
|
// "text/gemini": ["gmi", "gemini"]
|
|
|
|
},
|
2020-01-12 11:05:38 +08:00
|
|
|
//locations: An array of locations of static files for GET requests.
|
2020-12-24 20:00:29 +08:00
|
|
|
"locations": [
|
|
|
|
{
|
|
|
|
//uri_prefix: The URI prefix of the location prefixed with "/", the default value is "" that disables the location.
|
|
|
|
//"uri_prefix": "/.well-known/acme-challenge/",
|
|
|
|
//default_content_type: The default content type of the static files without
|
|
|
|
//an extension. empty string by default.
|
|
|
|
"default_content_type": "text/plain",
|
|
|
|
//alias: The location in file system, if it is prefixed with "/", it
|
|
|
|
//presents an absolute path, otherwise it presents a relative path to
|
|
|
|
//the document_root path.
|
|
|
|
//The default value is "" which means use the document root path as the location base path.
|
|
|
|
"alias": "",
|
|
|
|
//is_case_sensitive: indicates whether the URI prefix is case sensitive.
|
|
|
|
"is_case_sensitive": false,
|
|
|
|
//allow_all: true by default. If it is set to false, only static files with a valid extension can be accessed.
|
|
|
|
"allow_all": true,
|
|
|
|
//is_recursive: true by default. If it is set to false, files in sub directories can't be accessed.
|
|
|
|
"is_recursive": true,
|
|
|
|
//filters: string array, the filters applied to the location.
|
|
|
|
"filters": []
|
|
|
|
}
|
|
|
|
],
|
2021-03-13 19:13:54 +08:00
|
|
|
//max_connections: maximum number of connections, 100000 by default
|
2019-03-12 18:21:35 +08:00
|
|
|
"max_connections": 100000,
|
2021-03-13 19:13:54 +08:00
|
|
|
//max_connections_per_ip: maximum number of connections per clinet, 0 by default which means no limit
|
2019-03-12 18:21:35 +08:00
|
|
|
"max_connections_per_ip": 0,
|
|
|
|
//Load_dynamic_views: False by default, when set to true, drogon
|
|
|
|
//compiles and loads dynamically "CSP View Files" in directories defined
|
|
|
|
//by "dynamic_views_path"
|
|
|
|
"load_dynamic_views": false,
|
|
|
|
//dynamic_views_path: If the path isn't prefixed with /, ./ or ../,
|
|
|
|
//it is relative path of document_root path
|
|
|
|
"dynamic_views_path": [
|
|
|
|
"./views"
|
|
|
|
],
|
2020-02-16 17:19:16 +08:00
|
|
|
//dynamic_views_output_path: Default by an empty string which means the output path of source
|
|
|
|
//files is the path where the csp files locate. If the path isn't prefixed with /, it is relative
|
|
|
|
//path of the current working directory.
|
|
|
|
"dynamic_views_output_path": "",
|
2023-03-01 10:49:25 +08:00
|
|
|
//json_parser_stack_limit: 1000 by default, the maximum number of stack depth when reading a json string by the jsoncpp library.
|
|
|
|
"json_parser_stack_limit": 1000,
|
2020-06-24 08:11:32 +08:00
|
|
|
//enable_unicode_escaping_in_json: true by default, enable unicode escaping in json.
|
|
|
|
"enable_unicode_escaping_in_json": true,
|
2020-12-24 20:00:29 +08:00
|
|
|
//float_precision_in_json: set precision of float number in json.
|
|
|
|
"float_precision_in_json": {
|
|
|
|
//precision: 0 by default, 0 means use the default precision of the jsoncpp lib.
|
|
|
|
"precision": 0,
|
|
|
|
//precision_type: must be "significant" or "decimal", defaults to "significant" that means
|
|
|
|
//setting max number of significant digits in string, "decimal" means setting max number of
|
|
|
|
//digits after "." in string
|
|
|
|
"precision_type": "significant"
|
|
|
|
},
|
2019-03-12 18:21:35 +08:00
|
|
|
//log: Set log output, drogon output logs to stdout by default
|
|
|
|
"log": {
|
|
|
|
//log_path: Log file path,empty by default,in which case,logs are output to the stdout
|
|
|
|
//"log_path": "./",
|
|
|
|
//logfile_base_name: Log file base name,empty by default which means drogon names logfile as
|
|
|
|
//drogon.log ...
|
|
|
|
"logfile_base_name": "",
|
|
|
|
//log_size_limit: 100000000 bytes by default,
|
|
|
|
//When the log file size reaches "log_size_limit", the log file is switched.
|
|
|
|
"log_size_limit": 100000000,
|
2023-06-09 13:14:03 +08:00
|
|
|
//max_files: 0 by default,
|
|
|
|
//When the number of old log files exceeds "max_files", the oldest file will be deleted. 0 means never delete.
|
|
|
|
"max_files": 0,
|
2019-03-12 18:21:35 +08:00
|
|
|
//log_level: "DEBUG" by default,options:"TRACE","DEBUG","INFO","WARN"
|
|
|
|
//The TRACE level is only valid when built in DEBUG mode.
|
2023-02-19 23:04:25 +08:00
|
|
|
"log_level": "DEBUG",
|
|
|
|
//display_local_time: false by default, if true, the log time is displayed in local time
|
|
|
|
"display_local_time": false
|
2019-03-12 18:21:35 +08:00
|
|
|
},
|
|
|
|
//run_as_daemon: False by default
|
|
|
|
"run_as_daemon": false,
|
2021-03-11 22:03:02 +08:00
|
|
|
//handle_sig_term: True by default
|
|
|
|
"handle_sig_term": true,
|
2019-03-12 18:21:35 +08:00
|
|
|
//relaunch_on_error: False by default, if true, the program will be restart by the parent after exiting;
|
|
|
|
"relaunch_on_error": false,
|
2020-01-12 11:05:38 +08:00
|
|
|
//use_sendfile: True by default, if true, the program
|
2019-03-12 18:21:35 +08:00
|
|
|
//uses sendfile() system-call to send static files to clients;
|
|
|
|
"use_sendfile": true,
|
|
|
|
//use_gzip: True by default, use gzip to compress the response body's content;
|
|
|
|
"use_gzip": true,
|
2020-04-04 18:15:15 +08:00
|
|
|
//use_brotli: False by default, use brotli to compress the response body's content;
|
|
|
|
"use_brotli": false,
|
2019-03-25 17:44:22 +08:00
|
|
|
//static_files_cache_time: 5 (seconds) by default, the time in which the static file response is cached,
|
2019-03-12 18:21:35 +08:00
|
|
|
//0 means cache forever, the negative value means no cache
|
|
|
|
"static_files_cache_time": 5,
|
|
|
|
//simple_controllers_map: Used to configure mapping from path to simple controller
|
2023-09-04 10:16:44 +08:00
|
|
|
//"simple_controllers_map": [
|
|
|
|
// {
|
|
|
|
// "path": "/path/name",
|
|
|
|
// "controller": "controllerClassName",
|
|
|
|
// "http_methods": [
|
|
|
|
// "get",
|
|
|
|
// "post"
|
|
|
|
// ],
|
|
|
|
// "filters": [
|
|
|
|
// "FilterClassName"
|
|
|
|
// ]
|
|
|
|
// }
|
|
|
|
//],
|
2019-03-12 18:21:35 +08:00
|
|
|
//idle_connection_timeout: Defaults to 60 seconds, the lifetime
|
|
|
|
//of the connection without read or write
|
|
|
|
"idle_connection_timeout": 60,
|
2019-07-31 19:44:32 +08:00
|
|
|
//server_header_field: Set the 'Server' header field in each response sent by drogon,
|
|
|
|
//empty string by default with which the 'Server' header field is set to "Server: drogon/version string\r\n"
|
2019-03-12 18:21:35 +08:00
|
|
|
"server_header_field": "",
|
2019-07-31 19:44:32 +08:00
|
|
|
//enable_server_header: Set true to force drogon to add a 'Server' header to each HTTP response. The default
|
|
|
|
//value is true.
|
|
|
|
"enable_server_header": true,
|
|
|
|
//enable_date_header: Set true to force drogon to add a 'Date' header to each HTTP response. The default
|
|
|
|
//value is true.
|
|
|
|
"enable_date_header": true,
|
2019-04-29 14:47:23 +08:00
|
|
|
//keepalive_requests: Set the maximum number of requests that can be served through one keep-alive connection.
|
2019-03-12 18:21:35 +08:00
|
|
|
//After the maximum number of requests are made, the connection is closed.
|
|
|
|
//The default value of 0 means no limit.
|
|
|
|
"keepalive_requests": 0,
|
2019-04-29 14:47:23 +08:00
|
|
|
//pipelining_requests: Set the maximum number of unhandled requests that can be cached in pipelining buffer.
|
2019-03-12 18:21:35 +08:00
|
|
|
//After the maximum number of requests are made, the connection is closed.
|
|
|
|
//The default value of 0 means no limit.
|
2019-05-03 14:44:20 +08:00
|
|
|
"pipelining_requests": 0,
|
|
|
|
//gzip_static: If it is set to true, when the client requests a static file, drogon first finds the compressed
|
|
|
|
//file with the extension ".gz" in the same path and send the compressed file to the client.
|
|
|
|
//The default value of gzip_static is true.
|
2019-05-07 14:04:37 +08:00
|
|
|
"gzip_static": true,
|
2020-02-23 17:39:03 +08:00
|
|
|
//br_static: If it is set to true, when the client requests a static file, drogon first finds the compressed
|
|
|
|
//file with the extension ".br" in the same path and send the compressed file to the client.
|
|
|
|
//The default value of br_static is true.
|
|
|
|
"br_static": true,
|
2019-06-06 14:59:49 +08:00
|
|
|
//client_max_body_size: Set the maximum body size of HTTP requests received by drogon. The default value is "1M".
|
2019-05-07 14:04:37 +08:00
|
|
|
//One can set it to "1024", "1k", "10M", "1G", etc. Setting it to "" means no limit.
|
|
|
|
"client_max_body_size": "1M",
|
2019-06-06 14:59:49 +08:00
|
|
|
//max_memory_body_size: Set the maximum body size in memory of HTTP requests received by drogon. The default value is "64K" bytes.
|
|
|
|
//If the body size of a HTTP request exceeds this limit, the body is stored to a temporary file for processing.
|
|
|
|
//Setting it to "" means no limit.
|
|
|
|
"client_max_memory_body_size": "64K",
|
|
|
|
//client_max_websocket_message_size: Set the maximum size of messages sent by WebSocket client. The default value is "128K".
|
2019-05-07 14:04:37 +08:00
|
|
|
//One can set it to "1024", "1k", "10M", "1G", etc. Setting it to "" means no limit.
|
2020-11-25 19:47:36 +08:00
|
|
|
"client_max_websocket_message_size": "128K",
|
|
|
|
//reuse_port: Defaults to false, users can run multiple processes listening on the same port at the same time.
|
2023-02-19 23:04:25 +08:00
|
|
|
"reuse_port": false,
|
2023-05-08 23:37:52 +08:00
|
|
|
// enabled_compressed_request: Defaults to false. If true the server will automatically decompress compressed request bodies.
|
2022-07-02 22:07:48 +08:00
|
|
|
// Currently only gzip and br are supported. Note: max_memory_body_size and max_body_size applies twice for compressed requests.
|
|
|
|
// Once when receiving and once when decompressing. i.e. if the decompressed body is larger than max_body_size, the request
|
|
|
|
// will be rejected.
|
2023-05-08 23:37:52 +08:00
|
|
|
"enabled_compressed_request": false
|
2019-03-25 17:44:22 +08:00
|
|
|
},
|
2019-03-29 15:34:14 +08:00
|
|
|
//plugins: Define all plugins running in the application
|
2020-12-24 20:00:29 +08:00
|
|
|
"plugins": [
|
|
|
|
{
|
|
|
|
//name: The class name of the plugin
|
2023-09-04 10:16:44 +08:00
|
|
|
"name": "drogon::plugin::PromExporter",
|
2020-12-24 20:00:29 +08:00
|
|
|
//dependencies: Plugins that the plugin depends on. It can be commented out
|
|
|
|
"dependencies": [],
|
|
|
|
//config: The configuration of the plugin. This json object is the parameter to initialize the plugin.
|
|
|
|
//It can be commented out
|
|
|
|
"config": {
|
2023-09-04 10:16:44 +08:00
|
|
|
"path": "/metrics"
|
2020-12-24 20:00:29 +08:00
|
|
|
}
|
2019-03-29 15:34:14 +08:00
|
|
|
}
|
2020-12-24 20:00:29 +08:00
|
|
|
],
|
2019-03-25 17:44:22 +08:00
|
|
|
//custom_config: custom configuration for users. This object can be get by the app().getCustomConfig() method.
|
2020-06-07 14:43:05 +08:00
|
|
|
"custom_config": {
|
2020-06-20 20:21:14 +08:00
|
|
|
"realm": "drogonRealm",
|
|
|
|
"opaque": "drogonOpaque",
|
2020-12-24 20:00:29 +08:00
|
|
|
"credentials": [
|
|
|
|
{
|
|
|
|
"user": "drogon",
|
|
|
|
"password": "dr0g0n"
|
|
|
|
}
|
|
|
|
]
|
2020-06-07 14:43:05 +08:00
|
|
|
}
|
2021-04-29 10:13:34 +08:00
|
|
|
}
|