-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.js
More file actions
63 lines (55 loc) · 1.34 KB
/
app.js
File metadata and controls
63 lines (55 loc) · 1.34 KB
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
var Hapi = require("hapi");
var Lookup = require("object-path");
var _ = require("lodash");
var server = new Hapi.Server({
cache: {
engine: require("catbox-memory"),
name: "zip",
allowMixedContent: true, // Allow caching Buffers
maxByteSize: 104857600 * 2, // 200mb
},
connections: {
routes: {
json: {
space: 2,
},
},
},
});
var config = _.defaults(require("./config"), {
plugins: {},
});
var plugins = [
{
register: require("good"),
options: {
opsInterval: 1000 * 30,
reporters: [{
reporter: require('good-console'),
args:[{ log: "*", error: "*", request: "*", response: "*", ops: "*" }]
}],
}
}, {
register: require("./index"),
options: { config: config },
}
];
server.connection({
host: Lookup.get(config, "services.proxy.public.host", "localhost"),
address: "0.0.0.0",
port: Lookup.get(config, "services.proxy.local.port", 8080),
labels: ["proxy"],
});
server.register(plugins, function (err) {
if (err) {
server.log("error", "Error registering plugins: " + err.message, err);
process.exit(1);
}
server.start(function (err) {
if (err) {
server.log("error", "Error starting server: " + err.message, err);
process.exit(1);
}
server.log("info", "Server running at: " + server.info.uri);
});
});