-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathconfig.default.js
93 lines (81 loc) · 2.7 KB
/
config.default.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
'use strict'
const fs = require('fs')
const crypto = require('crypto')
module.exports = {
// This is the root path for the portal, without trailing slash. It
// might be used to host your system at www.example.com/portal.
root: '',
// These are the connection details for RethinkDB.
db: {
host: 'rethinkdb',
db: 'gandhi',
},
// To make things run faster, we keep a pool of Rethinkdb connections
// inside each process. You can tune the pool's settings here.
pool: {
max: 30,
min: 1,
timeout: 30000,
},
// These are the connection details for Redis.
redis: {
host: 'redis',
},
// When gandhi can't use an atomic operation to alter a document in
// rethinkdb, we need to lock it, so we don't try to process multiple
// writes at the same time. You can tune the lock settings here.
lock: {
retry: 100,
timeout: 30000,
},
// Authentication is made persistent by ust of Json Web Tokens. You
// must provide a secret for cryptographically signing these tokens.
// Make sure this stays secret, or an attacker could impersonate
// system users.
auth: {
secret: '',
},
// Gandhi used nodemailer to support almost any mail sending option
// out there. You can configure it here. Learn more at:
// https://github.com/andris9/Nodemailer
mail: {
transport: {
service: 'Mandrill',
auth: {
user: 'username@example.com',
pass: 'password123',
},
},
defaults: {
from: 'test@test.gandhi.io',
},
},
// Gandhi uses a module system to add new functionality. In fact,
// many core components are actually written as modules. This must
// be an array of paths to the various different modules you wish
// to use.
//
// In this example, we programmatically build a list of modules from
// the modules directory.
modules: fs.readdirSync(__dirname + '/lib/modules').map(function (dir) {
return __dirname + '/lib/modules/' + dir
}),
// Where do you want to store uploaded files? Right now, this only
// supports using the local filesystem or NFS, but in the future
// it will support other options like S3 and CloudFiles
files: {
directory: __dirname + '/uploads',
},
// On what port do you want gandhi to listen? In our opinion, it's
// best to run apps behind something like NGINX, but there's nothing
// stopping you from just running directly on port 80.
port: 3000,
}
// get or set the secret
const secret = __dirname + '/secret.txt'
if (fs.existsSync(secret)) {
module.exports.auth.secret = fs.readFileSync(secret, { encoding: 'base64' })
} else {
module.exports.auth.secret = crypto.randomBytes(256).toString('base64')
fs.writeFileSync(secret, module.exports.auth.secret)
}