]> git.r.bdr.sh - rbdr/dasein/blame - config/config.js
Merge branch 'release/1.0.0'
[rbdr/dasein] / config / config.js
CommitLineData
287fa13b
RBR
1'use strict';
2
3const Getenv = require('getenv');
4
5const internals = {};
6
a6ccda0f
RBR
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 */
287fa13b 26module.exports = internals.Config = {
a6ccda0f
RBR
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 */
287fa13b 40 jwt: {
a6ccda0f
RBR
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)
287fa13b 56 },
a6ccda0f
RBR
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 */
287fa13b 68 twitter: {
a6ccda0f
RBR
69 consumerKey: Getenv('DASEIN_TWITTER_CONSUMER_KEY'),
70 consumerSecret: Getenv('DASEIN_TWITTER_CONSUMER_SECRET')
287fa13b
RBR
71 }
72};