From a6ccda0fbc4df683f9568d85eb22b21684d2a0bd Mon Sep 17 00:00:00 2001 From: Rubén Beltrán del Río Date: Mon, 30 Jan 2017 02:47:14 -0600 Subject: Create and Show Posts (#3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📝 Update changelog (retroactive) SORRY * Add JSDoc * Document twitter helper * Add posts handler * Remove cookies, set routes under /api * Update readme for clearer callback instructions * Redirect callback to login with token * Add dasein paw helper * Remove unused hostname * Remove hostname, add expiration to config * Rename expiration ttl * Send TTL to posts handler * Add redis dependency * Add redis config to config file * Add DASEIN_REDIS_HOST to env.dist * Correct redis config structure * Add redis db to compose * Add redis to posts handler * Update dasein paw file * Git add uuid * Add first iteration of post handlers * Ignore docs in linter * Ignore generated assets * Ignore docs and assets * Add frontend dependencies + more koa * Add post creation to backend * Adjust readme to show actual callback route * Add npm build as part of docker process * Configure babel * Update paw * Add webpack config * Add frontend code * List globals --- config/config.js | 69 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 9 deletions(-) (limited to 'config/config.js') diff --git a/config/config.js b/config/config.js index 1c1c8a0..c82dced 100644 --- a/config/config.js +++ b/config/config.js @@ -4,18 +4,69 @@ const Getenv = require('getenv'); const internals = {}; +/** + * The main configuration object for Dasein. It will be used to + * initialize all of the sub-components. It can extend any property of + * the dasein object. + * + * @memberof Dasein + * @typedef {object} tConfiguration + * @property {number} [port=1927] the port where the app will listen on + * @property {string} [staticDirectory=static] the path, relative to the + * project root, where static assets live + * @property {number} [ttl=180] the time in seconds that posts + * remain alive + * @property {Dasein.tRedisConfiguration} redis the configuration to + * connect to the redis server + * @property {Dasein.tJWTConfiguration} jwt the configuration for the + * JWT authentication + * @property {Dasein.tTwitterConfiguration} twitter the configuration + * for twitter integration + */ module.exports = internals.Config = { - cookieKeys: Getenv.array('DASEIN_COOKIE_KEYS'), // Signatures for the cookies - port: Getenv.int('DASEIN_PORT', 1927), // Port to listen on - hostname: Getenv('DASEIN_HOSTNAME', 'localhost'), // Domain to listen on, used for cookies - staticDirectory: Getenv('DASEIN_STATIC_DIRECTORY', 'static'), // Location of static assets + port: Getenv.int('DASEIN_PORT', 1927), + staticDirectory: Getenv('DASEIN_STATIC_DIRECTORY', 'static'), + ttl: Getenv.int('DASEIN_TTL', 180), + + /** + * Configures the behavior of the JWT token. + * + * @memberof Dasein + * @typedef {object} tJWTConfiguration + * @property {number} [duration=86400] the duration of the JWT in + * seconds + * @property {string} secret the secret used to sign the JWT + */ jwt: { - cookieName: Getenv('DASEIN_JWT_COOKIE_NAME', 'dasein_jwt'), // Name of cookie where jwt is stored - duration: Getenv('DASEIN_JWT_DURATION', 86400), // Duration of JWT (24 hours) - secret: Getenv('DASEIN_JWT_SECRET') // Secret to sign JWT + duration: Getenv.int('DASEIN_JWT_DURATION', 86400), + secret: Getenv('DASEIN_JWT_SECRET') + }, + + /** + * Information required to connect to the redis server + * + * @memberof Dasein + * @typedef {object} tRedisConfiguration + * @property {string} host the location of the redis host + * @property {string} [post=6379] port where redis server is listening + */ + redis: { + host: Getenv('DASEIN_REDIS_HOST'), + port: Getenv.int('DASEIN_REDIS_PORT', 6379) }, + + /** + * Configures the twitter integration values + * + * @memberof Dasein + * @typedef {object} tTwitterConfiguration + * @property {string} consumerKey The consumer key used to authenticate + * with the twitter API + * @property {string} consumerSecret the consumer secret used to + * authenticate with the twitter API + */ twitter: { - consumerKey: Getenv('DASEIN_TWITTER_CONSUMER_KEY'), // Consumer key for twitter - consumerSecret: Getenv('DASEIN_TWITTER_CONSUMER_SECRET') // Consumer secret for twitter + consumerKey: Getenv('DASEIN_TWITTER_CONSUMER_KEY'), + consumerSecret: Getenv('DASEIN_TWITTER_CONSUMER_SECRET') } }; -- cgit