]> git.r.bdr.sh - rbdr/forum/blame_incremental - config/config.js
Add backend files
[rbdr/forum] / config / config.js
... / ...
CommitLineData
1import Getenv from 'getenv2';
2import Joi from 'joi';
3
4/**
5 * The main configuration object for the Forum backend. It will be used to
6 * initialize all of the sub-components. It can extend any property of
7 * the forum object.
8 *
9 * @typedef {object} tForumBackendConfiguration
10 * @property {number} [port=1978] the port where the app will listen on
11 * @property {string} [staticDirectory=static] the path, relative to the
12 * project root, where static assets live
13 * @property {number} [ttl=180] the time in seconds that posts
14 * remain alive
15 * @property {tRethinkDBConfiguration} rethinkDB the configuration to
16 * connect to the rethinkDB server
17 * @property {tJWTConfiguration} jwt the configuration for the
18 * JWT authentication
19 */
20export default {
21 port: Getenv('FORUM_PORT', Joi.number().integer(), 1978),
22 staticDirectory: Getenv('FORUM_STATIC_DIRECTORY', Joi.string(), 'static'),
23 ttl: Getenv('FORUM_TTL', Joi.number().integer(), 180),
24
25 /**
26 * Configures the behavior of the JWT token.
27 *
28 * @typedef {object} tJWTConfiguration
29 * @property {number} [duration=86400] the duration of the JWT in
30 * seconds
31 * @property {string} secret the secret used to sign the JWT
32 */
33 jwt: {
34 duration: Getenv('FORUM_JWT_DURATION', Joi.number().integer(), 86400),
35 secret: Getenv('FORUM_JWT_SECRET', Joi.string())
36 },
37
38 /**
39 * Information required to connect to the rethinkDB server
40 *
41 * @typedef {object} tRethinkDBConfiguration
42 * @property {string} host the location of the rethinkDB host
43 * @property {string} [post=6379] port where rethinkDB server is listening
44 */
45 rethinkDB: {
46 host: Getenv('FORUM_RETHINK_DB_HOST', Joi.string()),
47 port: Getenv('FORUM_RETHINK_DB_PORT', Joi.number().integer(), 28015)
48 }
49};