]> git.r.bdr.sh - rbdr/dasein/blob - config/config.js
Merge branch 'release/1.0.0'
[rbdr/dasein] / config / config.js
1 'use strict';
2
3 const Getenv = require('getenv');
4
5 const internals = {};
6
7 /**
8 * The main configuration object for Dasein. It will be used to
9 * initialize all of the sub-components. It can extend any property of
10 * the dasein object.
11 *
12 * @memberof Dasein
13 * @typedef {object} tConfiguration
14 * @property {number} [port=1927] the port where the app will listen on
15 * @property {string} [staticDirectory=static] the path, relative to the
16 * project root, where static assets live
17 * @property {number} [ttl=180] the time in seconds that posts
18 * remain alive
19 * @property {Dasein.tRedisConfiguration} redis the configuration to
20 * connect to the redis server
21 * @property {Dasein.tJWTConfiguration} jwt the configuration for the
22 * JWT authentication
23 * @property {Dasein.tTwitterConfiguration} twitter the configuration
24 * for twitter integration
25 */
26 module.exports = internals.Config = {
27 port: Getenv.int('DASEIN_PORT', 1927),
28 staticDirectory: Getenv('DASEIN_STATIC_DIRECTORY', 'static'),
29 ttl: Getenv.int('DASEIN_TTL', 180),
30
31 /**
32 * Configures the behavior of the JWT token.
33 *
34 * @memberof Dasein
35 * @typedef {object} tJWTConfiguration
36 * @property {number} [duration=86400] the duration of the JWT in
37 * seconds
38 * @property {string} secret the secret used to sign the JWT
39 */
40 jwt: {
41 duration: Getenv.int('DASEIN_JWT_DURATION', 86400),
42 secret: Getenv('DASEIN_JWT_SECRET')
43 },
44
45 /**
46 * Information required to connect to the redis server
47 *
48 * @memberof Dasein
49 * @typedef {object} tRedisConfiguration
50 * @property {string} host the location of the redis host
51 * @property {string} [post=6379] port where redis server is listening
52 */
53 redis: {
54 host: Getenv('DASEIN_REDIS_HOST'),
55 port: Getenv.int('DASEIN_REDIS_PORT', 6379)
56 },
57
58 /**
59 * Configures the twitter integration values
60 *
61 * @memberof Dasein
62 * @typedef {object} tTwitterConfiguration
63 * @property {string} consumerKey The consumer key used to authenticate
64 * with the twitter API
65 * @property {string} consumerSecret the consumer secret used to
66 * authenticate with the twitter API
67 */
68 twitter: {
69 consumerKey: Getenv('DASEIN_TWITTER_CONSUMER_KEY'),
70 consumerSecret: Getenv('DASEIN_TWITTER_CONSUMER_SECRET')
71 }
72 };