|
| 1 | +/* This is a JSON format configuration file |
| 2 | + */ |
| 3 | +{ |
| 4 | + /* |
| 5 | + //ssl:The global SSL settings. "key" and "cert" are the path to the SSL key and certificate. While |
| 6 | + // "conf" is an array of 1 or 2-element tuples that supplies file style options for `SSL_CONF_cmd`. |
| 7 | + "ssl": { |
| 8 | + "cert": "../../trantor/trantor/tests/server.pem", |
| 9 | + "key": "../../trantor/trantor/tests/server.pem", |
| 10 | + "conf": [ |
| 11 | + //["Options", "-SessionTicket"], |
| 12 | + //["Options", "Compression"] |
| 13 | + ] |
| 14 | + }, |
| 15 | + "listeners": [ |
| 16 | + { |
| 17 | + //address: Ip address,0.0.0.0 by default |
| 18 | + "address": "0.0.0.0", |
| 19 | + //port: Port number |
| 20 | + "port": 80, |
| 21 | + //https: If true, use https for security,false by default |
| 22 | + "https": false |
| 23 | + }, |
| 24 | + { |
| 25 | + "address": "0.0.0.0", |
| 26 | + "port": 443, |
| 27 | + "https": true, |
| 28 | + //cert,key: Cert file path and key file path, empty by default, |
| 29 | + //if empty, use the global setting |
| 30 | + "cert": "", |
| 31 | + "key": "", |
| 32 | + //use_old_tls: enable the TLS1.0/1.1, false by default |
| 33 | + "use_old_tls": false, |
| 34 | + "ssl_conf": [ |
| 35 | + //["MinProtocol", "TLSv1.3"] |
| 36 | + ] |
| 37 | + } |
| 38 | + ], |
| 39 | + "db_clients": [ |
| 40 | + { |
| 41 | + //name: Name of the client,'default' by default |
| 42 | + //"name":"", |
| 43 | + //rdbms: Server type, postgresql,mysql or sqlite3, "postgresql" by default |
| 44 | + "rdbms": "postgresql", |
| 45 | + //filename: Sqlite3 db file name |
| 46 | + //"filename":"", |
| 47 | + //host: Server address,localhost by default |
| 48 | + "host": "127.0.0.1", |
| 49 | + //port: Server port, 5432 by default |
| 50 | + "port": 5432, |
| 51 | + //dbname: Database name |
| 52 | + "dbname": "test", |
| 53 | + //user: 'postgres' by default |
| 54 | + "user": "", |
| 55 | + //passwd: '' by default |
| 56 | + "passwd": "", |
| 57 | + //is_fast: false by default, if it is true, the client is faster but user can't call |
| 58 | + //any synchronous interface of it. |
| 59 | + "is_fast": false, |
| 60 | + //client_encoding: The character set used by the client. it is empty string by default which |
| 61 | + //means use the default character set. |
| 62 | + //"client_encoding": "", |
| 63 | + //number_of_connections: 1 by default, if the 'is_fast' is true, the number is the number of |
| 64 | + //connections per IO thread, otherwise it is the total number of all connections. |
| 65 | + "number_of_connections": 1, |
| 66 | + //timeout: -1.0 by default, in seconds, the timeout for executing a SQL query. |
| 67 | + //zero or negative value means no timeout. |
| 68 | + "timeout": -1.0, |
| 69 | + //"auto_batch": this feature is only available for the PostgreSQL driver(version >= 14.0), see |
| 70 | + // the wiki for more details. |
| 71 | + "auto_batch": false |
| 72 | + } |
| 73 | + ], |
| 74 | + "redis_clients": [ |
| 75 | + { |
| 76 | + //name: Name of the client,'default' by default |
| 77 | + //"name":"", |
| 78 | + //host: Server IP, 127.0.0.1 by default |
| 79 | + "host": "127.0.0.1", |
| 80 | + //port: Server port, 6379 by default |
| 81 | + "port": 6379, |
| 82 | + //username: '' by default which means 'default' in redis ACL |
| 83 | + "username": "", |
| 84 | + //passwd: '' by default |
| 85 | + "passwd": "", |
| 86 | + //db index: 0 by default |
| 87 | + "db": 0, |
| 88 | + //is_fast: false by default, if it is true, the client is faster but user can't call |
| 89 | + //any synchronous interface of it. |
| 90 | + "is_fast": false, |
| 91 | + //number_of_connections: 1 by default, if the 'is_fast' is true, the number is the number of |
| 92 | + //connections per IO thread, otherwise it is the total number of all connections. |
| 93 | + "number_of_connections": 1, |
| 94 | + //timeout: -1.0 by default, in seconds, the timeout for executing a command. |
| 95 | + //zero or negative value means no timeout. |
| 96 | + "timeout": -1.0 |
| 97 | + } |
| 98 | + ],*/ |
| 99 | + "app": { |
| 100 | + //number_of_threads: The number of IO threads, 1 by default, if the value is set to 0, the number of threads |
| 101 | + //is the number of CPU cores |
| 102 | + "number_of_threads": 1, |
| 103 | + //enable_session: False by default |
| 104 | + "enable_session": false, |
| 105 | + "session_timeout": 0, |
| 106 | + //string value of SameSite attribute of the Set-Cookie HTTP respone header |
| 107 | + //valid value is either 'Null' (default), 'Lax', 'Strict' or 'None' |
| 108 | + "session_same_site" : "Null", |
| 109 | + //document_root: Root path of HTTP document, defaut path is ./ |
| 110 | + "document_root": "./", |
| 111 | + //home_page: Set the HTML file of the home page, the default value is "index.html" |
| 112 | + //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 |
| 113 | + //to the request for "/". |
| 114 | + "home_page": "index.html", |
| 115 | + //use_implicit_page: enable implicit pages if true, true by default |
| 116 | + "use_implicit_page": true, |
| 117 | + //implicit_page: Set the file which would the server access in a directory that a user accessed. |
| 118 | + //For example, by default, http://localhost/a-directory resolves to http://localhost/a-directory/index.html. |
| 119 | + "implicit_page": "index.html", |
| 120 | + //static_file_headers: Headers for static files |
| 121 | + /*"static_file_headers": [ |
| 122 | + { |
| 123 | + "name": "field-name", |
| 124 | + "value": "field-value" |
| 125 | + } |
| 126 | + ],*/ |
| 127 | + //upload_path: The path to save the uploaded file. "uploads" by default. |
| 128 | + //If the path isn't prefixed with /, ./ or ../, |
| 129 | + //it is relative path of document_root path |
| 130 | + "upload_path": "uploads", |
| 131 | + /* file_types: |
| 132 | + * HTTP download file types,The file types supported by drogon |
| 133 | + * by default are "html", "js", "css", "xml", "xsl", "txt", "svg", |
| 134 | + * "ttf", "otf", "woff2", "woff" , "eot", "png", "jpg", "jpeg", |
| 135 | + * "gif", "bmp", "ico", "icns", etc. */ |
| 136 | + "file_types": [ |
| 137 | + "gif", |
| 138 | + "png", |
| 139 | + "jpg", |
| 140 | + "js", |
| 141 | + "css", |
| 142 | + "html", |
| 143 | + "ico", |
| 144 | + "swf", |
| 145 | + "xap", |
| 146 | + "apk", |
| 147 | + "cur", |
| 148 | + "xml" |
| 149 | + ], |
| 150 | + // mime: A dictionary that extends the internal MIME type support. Maps extensions into new MIME types |
| 151 | + // note: This option only adds MIME to the sever. `file_types` above have to be set for the server to serve them. |
| 152 | + "mime": { |
| 153 | + // "text/markdown": "md", |
| 154 | + // "text/gemini": ["gmi", "gemini"] |
| 155 | + }, |
| 156 | + //locations: An array of locations of static files for GET requests. |
| 157 | + "locations": [ |
| 158 | + { |
| 159 | + //uri_prefix: The URI prefix of the location prefixed with "/", the default value is "" that disables the location. |
| 160 | + //"uri_prefix": "/.well-known/acme-challenge/", |
| 161 | + //default_content_type: The default content type of the static files without |
| 162 | + //an extension. empty string by default. |
| 163 | + "default_content_type": "text/plain", |
| 164 | + //alias: The location in file system, if it is prefixed with "/", it |
| 165 | + //presents an absolute path, otherwise it presents a relative path to |
| 166 | + //the document_root path. |
| 167 | + //The default value is "" which means use the document root path as the location base path. |
| 168 | + "alias": "", |
| 169 | + //is_case_sensitive: indicates whether the URI prefix is case sensitive. |
| 170 | + "is_case_sensitive": false, |
| 171 | + //allow_all: true by default. If it is set to false, only static files with a valid extension can be accessed. |
| 172 | + "allow_all": true, |
| 173 | + //is_recursive: true by default. If it is set to false, files in sub directories can't be accessed. |
| 174 | + "is_recursive": true, |
| 175 | + //filters: string array, the filters applied to the location. |
| 176 | + "filters": [] |
| 177 | + } |
| 178 | + ], |
| 179 | + //max_connections: maximum number of connections, 100000 by default |
| 180 | + "max_connections": 100000, |
| 181 | + //max_connections_per_ip: maximum number of connections per clinet, 0 by default which means no limit |
| 182 | + "max_connections_per_ip": 0, |
| 183 | + //Load_dynamic_views: False by default, when set to true, drogon |
| 184 | + //compiles and loads dynamically "CSP View Files" in directories defined |
| 185 | + //by "dynamic_views_path" |
| 186 | + "load_dynamic_views": false, |
| 187 | + //dynamic_views_path: If the path isn't prefixed with /, ./ or ../, |
| 188 | + //it is relative path of document_root path |
| 189 | + "dynamic_views_path": [ |
| 190 | + "./views" |
| 191 | + ], |
| 192 | + //dynamic_views_output_path: Default by an empty string which means the output path of source |
| 193 | + //files is the path where the csp files locate. If the path isn't prefixed with /, it is relative |
| 194 | + //path of the current working directory. |
| 195 | + "dynamic_views_output_path": "", |
| 196 | + //enable_unicode_escaping_in_json: true by default, enable unicode escaping in json. |
| 197 | + "enable_unicode_escaping_in_json": true, |
| 198 | + //float_precision_in_json: set precision of float number in json. |
| 199 | + "float_precision_in_json": { |
| 200 | + //precision: 0 by default, 0 means use the default precision of the jsoncpp lib. |
| 201 | + "precision": 0, |
| 202 | + //precision_type: must be "significant" or "decimal", defaults to "significant" that means |
| 203 | + //setting max number of significant digits in string, "decimal" means setting max number of |
| 204 | + //digits after "." in string |
| 205 | + "precision_type": "significant" |
| 206 | + }, |
| 207 | + //log: Set log output, drogon output logs to stdout by default |
| 208 | + "log": { |
| 209 | + //log_path: Log file path,empty by default,in which case,logs are output to the stdout |
| 210 | + //"log_path": "./", |
| 211 | + //logfile_base_name: Log file base name,empty by default which means drogon names logfile as |
| 212 | + //drogon.log ... |
| 213 | + "logfile_base_name": "", |
| 214 | + //log_size_limit: 100000000 bytes by default, |
| 215 | + //When the log file size reaches "log_size_limit", the log file is switched. |
| 216 | + "log_size_limit": 100000000, |
| 217 | + //log_level: "DEBUG" by default,options:"TRACE","DEBUG","INFO","WARN" |
| 218 | + //The TRACE level is only valid when built in DEBUG mode. |
| 219 | + "log_level": "DEBUG" |
| 220 | + }, |
| 221 | + //run_as_daemon: False by default |
| 222 | + "run_as_daemon": false, |
| 223 | + //handle_sig_term: True by default |
| 224 | + "handle_sig_term": true, |
| 225 | + //relaunch_on_error: False by default, if true, the program will be restart by the parent after exiting; |
| 226 | + "relaunch_on_error": false, |
| 227 | + //use_sendfile: True by default, if true, the program |
| 228 | + //uses sendfile() system-call to send static files to clients; |
| 229 | + "use_sendfile": true, |
| 230 | + //use_gzip: True by default, use gzip to compress the response body's content; |
| 231 | + "use_gzip": true, |
| 232 | + //use_brotli: False by default, use brotli to compress the response body's content; |
| 233 | + "use_brotli": false, |
| 234 | + //static_files_cache_time: 5 (seconds) by default, the time in which the static file response is cached, |
| 235 | + //0 means cache forever, the negative value means no cache |
| 236 | + "static_files_cache_time": 5, |
| 237 | + //simple_controllers_map: Used to configure mapping from path to simple controller |
| 238 | + "simple_controllers_map": [ |
| 239 | + { |
| 240 | + "path": "/path/name", |
| 241 | + "controller": "controllerClassName", |
| 242 | + "http_methods": [ |
| 243 | + "get", |
| 244 | + "post" |
| 245 | + ], |
| 246 | + "filters": [ |
| 247 | + "FilterClassName" |
| 248 | + ] |
| 249 | + } |
| 250 | + ], |
| 251 | + //idle_connection_timeout: Defaults to 60 seconds, the lifetime |
| 252 | + //of the connection without read or write |
| 253 | + "idle_connection_timeout": 60, |
| 254 | + //server_header_field: Set the 'Server' header field in each response sent by drogon, |
| 255 | + //empty string by default with which the 'Server' header field is set to "Server: drogon/version string\r\n" |
| 256 | + "server_header_field": "", |
| 257 | + //enable_server_header: Set true to force drogon to add a 'Server' header to each HTTP response. The default |
| 258 | + //value is true. |
| 259 | + "enable_server_header": true, |
| 260 | + //enable_date_header: Set true to force drogon to add a 'Date' header to each HTTP response. The default |
| 261 | + //value is true. |
| 262 | + "enable_date_header": true, |
| 263 | + //keepalive_requests: Set the maximum number of requests that can be served through one keep-alive connection. |
| 264 | + //After the maximum number of requests are made, the connection is closed. |
| 265 | + //The default value of 0 means no limit. |
| 266 | + "keepalive_requests": 0, |
| 267 | + //pipelining_requests: Set the maximum number of unhandled requests that can be cached in pipelining buffer. |
| 268 | + //After the maximum number of requests are made, the connection is closed. |
| 269 | + //The default value of 0 means no limit. |
| 270 | + "pipelining_requests": 0, |
| 271 | + //gzip_static: If it is set to true, when the client requests a static file, drogon first finds the compressed |
| 272 | + //file with the extension ".gz" in the same path and send the compressed file to the client. |
| 273 | + //The default value of gzip_static is true. |
| 274 | + "gzip_static": true, |
| 275 | + //br_static: If it is set to true, when the client requests a static file, drogon first finds the compressed |
| 276 | + //file with the extension ".br" in the same path and send the compressed file to the client. |
| 277 | + //The default value of br_static is true. |
| 278 | + "br_static": true, |
| 279 | + //client_max_body_size: Set the maximum body size of HTTP requests received by drogon. The default value is "1M". |
| 280 | + //One can set it to "1024", "1k", "10M", "1G", etc. Setting it to "" means no limit. |
| 281 | + "client_max_body_size": "1M", |
| 282 | + //max_memory_body_size: Set the maximum body size in memory of HTTP requests received by drogon. The default value is "64K" bytes. |
| 283 | + //If the body size of a HTTP request exceeds this limit, the body is stored to a temporary file for processing. |
| 284 | + //Setting it to "" means no limit. |
| 285 | + "client_max_memory_body_size": "64K", |
| 286 | + //client_max_websocket_message_size: Set the maximum size of messages sent by WebSocket client. The default value is "128K". |
| 287 | + //One can set it to "1024", "1k", "10M", "1G", etc. Setting it to "" means no limit. |
| 288 | + "client_max_websocket_message_size": "128K", |
| 289 | + //reuse_port: Defaults to false, users can run multiple processes listening on the same port at the same time. |
| 290 | + "reuse_port": false |
| 291 | + }, |
| 292 | + //plugins: Define all plugins running in the application |
| 293 | + "plugins": [ |
| 294 | + { |
| 295 | + //name: The class name of the plugin |
| 296 | + //"name": "drogon::plugin::SecureSSLRedirector", |
| 297 | + //dependencies: Plugins that the plugin depends on. It can be commented out |
| 298 | + "dependencies": [], |
| 299 | + //config: The configuration of the plugin. This json object is the parameter to initialize the plugin. |
| 300 | + //It can be commented out |
| 301 | + "config": { |
| 302 | + "ssl_redirect_exempt": [ |
| 303 | + ".*\\.jpg" |
| 304 | + ], |
| 305 | + "secure_ssl_host": "localhost:8849" |
| 306 | + } |
| 307 | + } |
| 308 | + ], |
| 309 | + //custom_config: custom configuration for users. This object can be get by the app().getCustomConfig() method. |
| 310 | + "custom_config": {} |
| 311 | +} |
0 commit comments