-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
executable file
·42 lines (35 loc) · 1.02 KB
/
server.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
#!/usr/bin/env node
var path = require('path');
var architect = require("architect");
// TODO: Need better args parser.
var configName = process.argv[2] || "default";
// when command line arguments are passed into this, we ignore them
// when loading the config file.
if (configName.indexOf("-") === 0) {
configName = "default";
}
var debug = false;
if (process.argv.indexOf("-d") >= 0 ) {
debug = true;
}
var real = false;
if (process.argv.indexOf("-r") >= 0 ) {
real = true;
}
var configPath = path.resolve(__dirname, "./configs/", configName);
var config = require(configPath);
config.containers.master.plugins.forEach(function(plugin) {
if (plugin.packagePath && /\/cloud9.core$/.test(plugin.packagePath)) {
plugin.debug = debug;
plugin.real = real;
}
});
architect.createApp(config, {
console: ((debug)?console:null)
}, function (err, app) {
if (err) {
console.error("While starting the '%s':", configPath);
throw err;
}
console.log("Started '%s'!", configPath);
});