This repository was archived by the owner on Sep 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault-config.js
244 lines (212 loc) · 4.78 KB
/
default-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
const $cfg = require("jumbo-core/config-options");
/**
* @name ApplicationConfig
*/
const ApplicationConfig = {
/**
* Used for styles of Error reporting
* In development mode Errors will be shown in browser (browser errors not implemented yet) and in console
* In production mode Errors will be logged just to file if log enabled
* @type {Configurations.Deployment}
* @default Development
*/
deployment: $cfg.Configurations.Deployment.Development,
/**
* For debuging; disable clustering and run app in one debugable process
* @default false
*/
debugMode: typeof v8debug === "object" || /(--debug)|(--inspect)/.test(process.execArgv.join("")),
/**
* For framework debuging - extra logs
*/
jumboDebugMode: false,
/**
* Protocol setting
* If you set HTTPS protocol specify privateKey and certificate paths
*/
protocol: {
/**
* @type {Configurations.Protocols}
* @default Http
*/
protocol: $cfg.Configurations.Protocols.Http,
/**
* Private key path (.key)
*/
privateKey: "",
/**
* Certificate path (.crt)
*/
certificate: "",
/**
* Or just PFX archive certificate
*/
pfx: "",
/**
* Certifice passphrase
*/
passphrase: null
},
/**
* Multi-core support
*/
clustering: {
/**
* 0 for automatic clustering driven by number of CPU's cores
* @type {number}
* @default 0
*/
numberOfWorkers: 0
},
/**
* Enable template cache and define memory limit
*/
cache: {
/**
* @type {boolean}
* @default true
*/
enabled: true,
// /**
// * @default HardDrive
// */
// storage: $cfg.Cache.HardDrive,
/**
* Size limit for templates saved in memory
* Jumbo store frequently used templates in memory
* @type {number}
* @default 10 MB
*/
memoryCacheSizeLimit: 10e6
},
/**
* Session configuration
*/
session: {
/**
* Name of cookie which stores users's session ID
* @type {string}
*/
sessionsCookieName: "JUMBOSESID",
/**
* Length of session's life in days. It'll be deleted from disk after that time
* @type {number}
* @default 30
*/
sessionLifetime: 30,
/**
* Limit size of data saved in memory
* Not implemented yet
* @type {number}
*/
memorySizeLimit: 20e6,
/**
* Disable sessions saving to disk - speed boost
* When true, memorySizeLimit is ignored
* @type {boolean}
* @default false
*/
justInMemory: false,
},
/**
* Enable log and set log level
*/
log: {
/**
* @type {boolean}
* @default true
*/
enabled: true,
/**
* @type {Configurations.LogLevels}
* @default Normal
*/
level: $cfg.Configurations.LogLevels.Normal
},
/**
* Maximal allowed number of requests per second. You can limit server stress.
* If more than specified request count will come, new requests in rest of one second obtain 429 code.
* Static files are counted into this number of requests
* @type { Number || null }
* @default null
*/
maxRequestPerSecond: null,
/**
* Enable prevention of (D)DOS attacks
* It internally enable requests monitoring which will count number of requests per IP
* If IP makes more request per second new requests from that IP will be refused with code 403.
* Requests will be still accepted by server but framework will refuse to continue and save resources which
* proccessing of that request can framework take.
*/
DOSPrevention: {
/**
* @type {boolean}
* @default true
*/
enabled: false,
/**
* If you use framework static server and your index page have
* more than 100 links (scripts, styles, images etc.) client will be blocked!
* @type {number}
* @default 100
*/
maxRequestPerIP: 100,
/**
* Duration of IP blocking [in seconds]
* @type {number}
* @default 3600
*/
blockTime: 3600
},
/**
* Allows you to use more locales (defined in URL right after first slash; eg. domain.tld/en-US/page/article/1)
*/
globalization: {
/**
* Allow using locales
* @type {boolean}
* @default false
*/
enabled: false,
/**
* Supported languages
*/
supportedLocales: ["en-US"],
/**
* Default language
*/
default: "en-US"
},
/**
* Maximal size of POST data
* @type {number}
* @default 5 MB
*/
maxPostDataSize: 5e6,
security: {
/**
* Should be X-Powered-By header removed?
* @type {boolean}
* @default false
*/
hidePoweredBy: false,
/**
* X-Frame-Options header
* @type {FrameOptions}
* @default FrameOption.Disabled
*/
xFrameOptions: $cfg.Configurations.FrameOptions.Disabled,
/**
* Add X-Content-Type-Options: nosniff header?
* @type {boolean}
* @default false
*/
noSniff: false,
/**
* Enable CSRF validation
*/
csrf: true
}
// You can define your own settings here,.. it'll be available via global Jumbo.Config
};
module.exports = ApplicationConfig;