diff options
| author | Ben Beltran <ben@nsovocal.com> | 2017-01-31 00:53:36 -0600 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2017-01-31 00:53:36 -0600 |
| commit | a3f9e2603dfdf8c492ec0dc355cd434fc6100f06 (patch) | |
| tree | 52c84831a3a6070e3e01c5ada5b862fd56f28327 /config | |
| parent | 7eb26514c478cfa06a797e9d63a29ef6a6d16d59 (diff) | |
| parent | f74591da2d5c42b8a1e658d17310e604bedcf856 (diff) | |
Diffstat (limited to 'config')
| -rw-r--r-- | config/config.js | 72 | ||||
| -rw-r--r-- | config/env.dist | 4 | ||||
| -rw-r--r-- | config/jsdoc.json | 9 | ||||
| -rw-r--r-- | config/webpack.js | 43 |
4 files changed, 128 insertions, 0 deletions
diff --git a/config/config.js b/config/config.js new file mode 100644 index 0000000..c82dced --- /dev/null +++ b/config/config.js @@ -0,0 +1,72 @@ +'use strict'; + +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 = { + 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: { + 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'), + consumerSecret: Getenv('DASEIN_TWITTER_CONSUMER_SECRET') + } +}; diff --git a/config/env.dist b/config/env.dist new file mode 100644 index 0000000..ffb50f2 --- /dev/null +++ b/config/env.dist @@ -0,0 +1,4 @@ +DASEIN_REDIS_HOST=location_of_redis_server +DASEIN_TWITTER_CONSUMER_KEY=your_twitter_key +DASEIN_TWITTER_CONSUMER_SECRET=your_twitter_secret +DASEIN_JWT_SECRET=some_random_string diff --git a/config/jsdoc.json b/config/jsdoc.json new file mode 100644 index 0000000..9e05753 --- /dev/null +++ b/config/jsdoc.json @@ -0,0 +1,9 @@ +{ + "plugins": ["plugins/markdown"], + "opts": { + "destination": "doc", + "readme": "README.md", + "template": "node_modules/docdash", + "recurse": true + } +} diff --git a/config/webpack.js b/config/webpack.js new file mode 100644 index 0000000..f808b06 --- /dev/null +++ b/config/webpack.js @@ -0,0 +1,43 @@ +'use strict'; + +const Path = require('path'); + +module.exports = { + entry: './app/dasein', + + output: { + path: Path.resolve(__dirname, '../static/assets'), + filename: 'bundle.js', + publicPath: '/assets/', + library: 'Dasein', + libraryTarget: 'umd' + }, + + module: { + loaders: [ + { + test: /\.js$/, + exclude: /(node_modules|doc)/, + loader: 'babel-loader', + query: { + presets: ['es2015'] + } + } + ] + }, + + resolve: { + modules: [ + 'node_modules', + Path.resolve(__dirname, '../app') + ], + + alias: { + 'vue$': 'vue/dist/vue.common.js' + } + }, + + extensions: ['.js', '.json', '.css'], + + context: Path.resolve(__dirname, '..') +}; |