This repository has been archived by the owner on Sep 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 162
/
config.js
97 lines (80 loc) · 2.42 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
exports.port = 15443
exports.host = 'localhost'
exports.httpPort = 15080
exports.cluster = { size : require("os").cpus().length }
// redis auth
exports.redis = { host: '127.0.0.1', port: 6379 }
exports.registryCouch = "https://isaacs.iriscouch.net/"
// npm config settings
exports.npm =
{ loglevel: "warn"
, registry: "http://registry.npmjs.org/"
, "strict-ssl": false
, _auth: ''
, username: ''
, _password: ''
}
// bunyan config
exports.log =
{ name: 'npm-www'
, level: 'trace'
}
exports.package = require('./package.json')
exports.contributors = require('fs').readFileSync('AUTHORS', 'utf8')
exports.errorPage = { debug: true }
exports.debug = true
// probably don't need to change these too often.
// extra fields we hang on the profile.
// format: [title, display template, url test]
// if it doesn't have a url test, then urls are not allowed.
// The actual value is escaped, so no markup is allowed ever.
exports.profileFields =
{ fullname: [ 'Full Name', '%s' ]
, email: [ 'Email', '<a href="mailto:%s">%s</a>', function (u) {
return u.protocol === 'mailto:'
} ]
, github: [ 'Github', '<a href="https://github.com/%s">%s</a>',
hostmatch(/^github.com$/) ]
, twitter: [ 'Twitter', '<a href="https://twitter.com/%s">@%s</a>',
hostmatch(/^twitter.com$/) ]
, homepage: [ 'Homepage', '<a href="%s">%s</a>',
hostmatch(/[^\.]+\.[^\.]+$/) ]
, freenode: [ 'IRC Handle', '%s' ]
}
function hostmatch (m) { return function (u) {
return u.host && u.host.match(m)
} }
exports.emailFrom = '"The npm Website Robot" <[email protected]>'
// For development only!
// Don't send 304s for templar (still does for styl and some others)
// npm config set npm-www:nocache 1
exports.nocache = process.env.npm_package_config_nocache === '1'
exports.templateOptions = {
cache: !exports.nocache
}
/*****************/
/* don't delete! */
/*****************/
var env = process.env.NODE_ENV
var admin
if (env === 'production') {
admin = require('./config.admin.js')
} else try {
if (env !== 'dev') {
admin = require('./config.admin.js')
} else {
admin = require('./config.dev.js')
}
} catch (er) {
console.error('Warning: No admin configurations. Not suitable for production use.')
admin = {}
}
Object.keys(admin).forEach(function (k) {
if (k === 'redisAuth') exports.redis.auth = admin[k]
exports[k] = admin[k]
})
if (module === require.main) {
// just show the configs
console.log(exports)
process.exit(0)
}