forked from MissionSung/actionhero
/
config.js
executable file
·173 lines (156 loc) · 5.61 KB
/
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
// actionHero Config File
// For use in version 3.1.0 or greater
// I will be loded into api.configData
var configData = {};
/////////////////////////
// General Information //
/////////////////////////
configData.general = {
"apiVersion": "4.3.6",
"serverName": "actionHero API",
// The welcome message seen by TCP and webSocket clients upon connection
"welcomeMessage" : "Hello! Welcome to the actionHero api",
// The location of this package relative to your project
"apiBaseDir": "./node_modules/actionHero/",
// The directory which will be the root for the /public route
"flatFileDirectory": "./public/",
// The body message to acompany 404 (file not found) errors regading flat files
"flatFileNotFoundMessage": "Sorry, that file is not found :(",
// The body message to acompany 404 (file not found) errors regading directories
"flatFileIndexPageNotFoundMessage": "Sorry, there is no index page for this folder :(",
// The message to acompany 500 errors (internal server errors)
"serverErrorMessage": "The server experienced an internal error",
// the chatRoom that TCP and webSocket clients are joined to when the connect
"defaultChatRoom": "defaultRoom",
// defaultLimit & defaultOffset are useful for limiting the length of response lists.
// These params will always be appended to any request as "limit" and "offest" unless set by the client
"defaultLimit": 100,
"defaultOffset": 0,
// The number of internal "workers" this node will have.
// Remember these are logical timers (not threads) so they will block if they are computationally intense
"workers" : 5,
// watch for changes in actions and tasks, and reload them on the fly
// This will not work in all operating systems [ http://nodejs.org/docs/latest/api/fs.html#fs_fs_watchfile_filename_options_listener ]
"developmentMode": false,
// the location of the directory to keep pidfiles
"pidFileDirectory": process.cwd() + "/pids/",
// how many pending actions can a single connection be working on
"simultaniousActions": 5
};
/////////////
// logging //
/////////////
configData.logger = {
transports: [
function(api){
return new (winston.transports.Console)({
colorize: true,
level: "debug",
timestamp: api.utils.sqlDateTime
});
},
function(api){
var fs = require('fs');
try{
fs.mkdirSync("./log");
console.log("created ./log directory");
}catch(e){
if(e.code != "EEXIST"){
console.log(e); process.exit();
}
}
return new (winston.transports.File)({
filename: './log/' + api.pids.title + '.log',
level: "info",
timestamp: true
});
}
]
};
///////////
// Redis //
///////////
configData.redis = {
"fake": true,
"host": "127.0.0.1",
"port": 6379,
"password": null,
"options": null,
"DB": 0
};
///////////////////////////////////////
// Common HTTP & HTTPS Configuration //
///////////////////////////////////////
configData.commonWeb = {
// Any additional headers you want actionHero to respond with
"httpHeaders" : { },
// route which actions will be served from
// secondary route against this route will be treated as actions, IE: /api/?action=test == /api/test/
"urlPathForActions" : "api",
// route which static files will be served from
// folder path (relitive to your project root) to server static content from
"urlPathForFiles" : "public",
// when visiting the root URL, should visitors see "api" or "public"?
// visitors can always visit /api and /public as normal
"rootEndpointType" : "api",
// the default filetype to server when a user requests a directory
"directoryFileType" : "index.html",
// the header which will be returend for all flat file served from /public. I am defiend in seconds
"flatFileCacheDuration" : 60,
// how often to prune pending messages for http clients. Setting this to `null` will disable http client message queues
"httpClientMessageTTL" : null,
// settings for determining the id of an http(s) requset (browser-fingerprint)
"fingerprintOptions" : {
cookieKey: "sessionID",
toSetCookie: true,
onlyStaticElements: false
},
// options to be applied to incomming file uplaods.
// more options and details at https://github.com/felixge/node-formidable
formOptions: {
uploadDir: "/tmp",
keepExtensions: false,
maxFieldsSize: 1024 * 1024 * 100
},
// when enabled, returnErrorCodes will modify the response header for http(s) clients if connection.error is not null.
// You can also set connection.responseHttpCode to specify a code per request.
"returnErrorCodes": false
};
/////////////////
// Web Server //
/////////////////
configData.httpServer = {
"enable": true,
"secure": false,
"port": 8080,
"bindIP": "0.0.0.0", // which IP to listen on (use 0.0.0.0 for all)
"keyFile": "./certs/server-key.pem", // only for secure = true
"certFile": "./certs/server-cert.pem" // only for secure = true
};
////////////////
// TCP Server //
////////////////
configData.tcpServer = {
"enable": false,
"secure": false,
"port": 5000,
"bindIP": "0.0.0.0", // which IP to listen on (use 0.0.0.0 for all)
"keyFile": "./certs/server-key.pem", // only for secure = true
"certFile": "./certs/server-cert.pem" // only for secure = true
};
/////////////////
// Web Sockets //
/////////////////
configData.webSockets = {
// You must have the web server enabled as well
"enable": false,
"logLevel" : 1,
"settings" : [
"browser client minification",
"browser client etag",
"browser client gzip"
],
"options" : {}
};
//////////////////////////////////
exports.configData = configData;