-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
75 lines (59 loc) · 2.48 KB
/
index.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
var express = require('express'),
fs = require('fs'),
path = require('path'),
app = express(),
_ = require('underscore');
/**
* Don't use process.cwd() as it breaks module encapsulation
* Instead, let's use module.parent if it's present, or the module itself if there is no parent (probably testing keystone directly if that's the case)
* This way, the consuming app/module can be an embedded node_module and path resolutions will still work
* (process.cwd() breaks module encapsulation if the consuming app/module is itself a node_module)
*/
var moduleRoot = (function (_rootPath) {
var parts = _rootPath.split(path.sep);
parts.pop(); //get rid of /node_modules from the end of the path
return parts.join(path.sep);
})(module.parent ? module.parent.paths[0] : module.paths[0]);
/**
* Seminarjs Class
*
* @api public
*/
var Seminarjs = function () {
this._options = {
'name': 'Seminarjs',
'brand': 'Seminarjs',
'logger': 'dev'
};
this.express = app;
this.io = null;
this.set('moduleRoot', moduleRoot);
this.set('env', process.env.NODE_ENV || 'development');
this.set('port', process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT);
this.set('host', process.env.HOST || process.env.IP || process.env.OPENSHIFT_NODEJS_IP);
this.set('listen', process.env.LISTEN);
this.set('ssl', process.env.SSL);
this.set('ssl port', process.env.SSL_PORT);
this.set('ssl host', process.env.SSL_HOST || process.env.SSL_IP);
this.set('ssl key', process.env.SSL_KEY);
this.set('ssl cert', process.env.SSL_CERT);
this.set('cookie secret', process.env.COOKIE_SECRET);
this.version = require('./package.json').version;
};
_.extend(Seminarjs.prototype, require('./private/lib/core/options')(moduleRoot));
/* Attach core functionality to Seminarjs.prototype */
Seminarjs.prototype.init = require('./private/lib/core/init');
Seminarjs.prototype.connect = require('./private/lib/core/connect');
Seminarjs.prototype.start = require('./private/lib/core/start');
Seminarjs.prototype.mount = require('./private/lib/core/mount');
Seminarjs.prototype.routes = require('./private/lib/core/routes');
Seminarjs.prototype.static = require('./private/lib/core/static');
Seminarjs.prototype.wrapHTMLError = require('./private/lib/core/wrapHTMLError');
Seminarjs.prototype.loadPlugin = require('./private/lib/core/loadPlugin');
Seminarjs.prototype.users = require('./private/lib/core/users');
/**
* The exports object is an instance of Seminarjs.
*
* @api public
*/
var seminarjs = module.exports = exports = new Seminarjs();