-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.ts
executable file
·240 lines (203 loc) · 5.35 KB
/
config.ts
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
const Config = {
// App Name
name: "Xpresser",
// App ENV, should be equivalent to NODE_ENV
env: "development",
// Enable Debugging
debug: {
// If set to false all debugging && debug logs are disabled
// While if set to true all debug settings are set to their configuration values.
enabled: true,
// Enable showing controller action on every request.
requests: {
// Enable Request Debugging
enabled: true,
// Enable color in logs
colored: true,
// Show all request log data
showAll: true,
// Items to show in the request debug log
show: {
time: false,
statusCode: true,
statusMessage: false
},
// Ignore specific urls
ignore: []
},
// Deprecated warnings
deprecationWarnings: {
enabled: true,
showStack: false
},
},
// Log Configurations
log: {
// Log enabled Plugins on boot
plugins: true,
serverDomainAndPort: false,
},
/**
* Project configurations
* Its safe to store project related settings here.
*/
project: {
fileExtension: ".js",
},
// Server Configuration
server: {
/**
* Middleware to handle server under maintenance mood
*
* if not found default is used.
*/
maintenanceMiddleware: "MaintenanceMiddleware.js",
/**
* Server Port for http connections
*/
port: 2000,
/**
* Url protocol (http|https)
* Use https if ssl is enabled.
*/
protocol: "http",
/**
* Server domain
*/
domain: "localhost",
/**
* Root Folder
* if calling xpresser from another folder not route
* specify e.g root: '/folder/'
*
* must end with trailing slash
*/
root: "/",
/**
* In most development environment this is required to be true.
* When true url helpers will append server port after server url
*
* @example
* http://localhost:2000/some/path
*/
includePortInUrl: true,
/**
* Specify Application BaseUrl directly
*/
baseUrl: "",
/**
* SSL Configurations.
*/
ssl: {
// Enable ssl
enabled: false,
// Ssl Port
port: 443,
},
/**
* Enable or disable PoweredBy
* For security purposes this is advised to be false.
*/
poweredBy: true,
/**
* Enable if you want public folder to be served
*/
servePublicFolder: true,
/**
* Xpresser comes with a few packages for security,
* You can enable or disable them here.
* ['bodyParser', 'flash' 'helmet']
*/
use: {
// Use BodyParser,
bodyParser: true,
// Enable Flash
flash: false,
},
requestEngine: {
dataKey: 'data',
proceedKey: 'proceed',
messageKey: '_say'
},
/**
* Xpresser Router Config
*/
router: {
pathCase: "snake" // snake or kebab
},
},
// Date Configurations
date: {
timezone: null,
format: "YYYY-MM-DD H:mm:ss",
},
// Paths Configurations
paths: {
base: __dirname,
// Should be relative to the base set above.
// e.g base+'/'+backend should resolve to /full/path/base/backend
backend: "base://backend",
// Must be relative to base
frontend: "frontend",
public: "public",
storage: "storage",
xjs: "xjs",
// Npm Dir
npm: "base://node_modules",
// Other Paths
routesFile: "backend://routes.js",
events: "backend://events",
controllers: "backend://controllers",
models: "backend://models",
middlewares: "backend://middlewares",
views: "backend://views",
jsonConfigs: "backend://",
configs: "backend://configs"
},
// Template Configurations
template: {
use: false,
engine: "ejs",
extension: "ejs",
locals: {
all: true,
query: false,
body: false,
stackedScripts: false,
},
},
// Response Configurations
response: {
cacheFiles: false,
cacheFileExtensions: ["js", "css"],
cacheIfMatch: [],
cacheMaxAge: 31536000,
overrideServerName: true,
},
// Artisan/Console Configurations
artisan: {
loadEvents: false,
singleModelName: true,
pluralizeModelTable: true,
// Replace factory files
factory: {
// model: null,
// controller: null,
// view: null
}
},
// Modules Configurations
packages: {},
// Plugins Configurations
plugins: {},
};
const Options = {
requireOnly: false,
autoBoot: false,
isConsole: false,
isTinker: false,
exposeDollarSign: true,
instanceId: undefined,
isFromXjsCli: false,
};
export = {Config, Options};