forked from rahul27458/studynotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig-node.js
More file actions
84 lines (74 loc) · 2.03 KB
/
config-node.js
File metadata and controls
84 lines (74 loc) · 2.03 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var config = require('./config')
var fs = require('fs')
var os = require('os')
var path = require('path')
/**
* Paths to different folders in this project. Used everywhere, so define them
* once here.
* @type {String}
*/
exports.root = __dirname
exports.tmp = path.join(exports.root, 'tmp')
exports.out = path.join(exports.root, 'out')
/**
* Number of "first click, free" essays that a given session can view before
* requesting that they subscribe. The user can always view if they have
* a referrer from an external site.
* @type {Number}
*/
exports.numFree = 2
/**
* Price of pro subscription (in cents!)
* @type {Number}
*/
exports.proPrice = 1400
/**
* Number of cores on this CPU
* @type {Number}
*/
exports.numCpus = config.isProd
? os.cpus().length
: 1
/**
* Maximum time to cache static resources (in milliseconds). This value is
* sent in the HTTP cache-control header. MaxCDN will obey it, caching
* the file for this length of time as well as passing it along to clients.
*
* @type {number}
*/
exports.maxAge = config.isProd
? 7 * 24 * 3600000 // 7 days
: 0
/**
* Maximum number of characters in a note/essay slug.
* @type {Number}
*/
exports.maxSlugLength = 40
/**
* MongoDB is web scale! (actually, web fail)
* @type {Object}
*/
exports.mongo = {
host: config.isProd
? 'athena.feross.net'
: 'localhost',
port: '27017',
database: 'studynotes'
}
var MD5_JS_MAIN
var MD5_JS_EXTRA
var MD5_CSS
try {
if (config.isProd) {
MD5_JS_MAIN = fs.readFileSync(exports.out + '/MD5_JS_MAIN').toString()
MD5_JS_EXTRA = fs.readFileSync(exports.out + '/MD5_JS_EXTRA').toString()
MD5_CSS = fs.readFileSync(exports.out + '/MD5_CSS').toString()
}
} catch (e) {}
/**
* Final paths for JS and CSS files. Uniquely named using the MD5 hash of the
* file contents, for cache busting.
*/
exports.jsMainPath = '/main' + (MD5_JS_MAIN ? '-' + MD5_JS_MAIN : '') + '.js'
exports.jsExtraPath = '/extra' + (MD5_JS_EXTRA ? '-' + MD5_JS_EXTRA : '') + '.js'
exports.cssPath = '/main' + (MD5_CSS ? '-' + MD5_CSS : '') + '.css'