Skip to content

Commit

Permalink
Use smart-config for config management
Browse files Browse the repository at this point in the history
  • Loading branch information
kostia-official committed Nov 25, 2016
1 parent cc5c7b4 commit 15b8b4f
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pingeon",
"description": "",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "",
"main": "src/",
"keywords": [
Expand Down Expand Up @@ -61,6 +61,7 @@
"promdash": "1.1.0",
"raven": "0.12.1",
"serve-favicon": "2.3.0",
"smart-config": "0.7.1",
"source-map-support": "0.4.2",
"worque": "0.9.3"
},
Expand All @@ -69,7 +70,6 @@
"babel-cli": "6.6.5",
"babel-core": "6.7.4",
"babel-eslint": "6.0.2",
"babel-loader": "6.2.4",
"babel-plugin-transform-runtime": "6.6.0",
"babel-preset-es2015": "6.6.0",
"babel-preset-stage-0": "6.5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/aws-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const _ = require('lodash');
const config = require('./config');
const config = require('smart-config');
const { title, gsmAppArn, apnsAppArn } = config.get('push');
const debug = require('debug')('app:helpers:aws-utils');
const RecipientProfile = require('../services/recipient-profile/model');
Expand Down
5 changes: 0 additions & 5 deletions src/helpers/config.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/helpers/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const debug = require('debug')('app:email');

const mandrill = require('mandrill-api/mandrill');
const { getVars, getTo } = require('./mandrill-utils');
const config = require('./config');
const config = require('smart-config');
const emailConfig = config.get('email');
const mandrillClient = new mandrill.Mandrill(emailConfig.key);

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const debug = require('debug')('app:pubsub');

const Fanout = require('fanoutpub');
const Faye = require('faye');
const config = require('./config');
const config = require('smart-config');
const pubsubConfig = config.get('pubsub');
const fanout = new Fanout.Fanout(pubsubConfig.id, pubsubConfig.key);
const faye = new Faye.Client(`http://${pubsubConfig.id}.fanoutcdn.com/bayeux`);
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/push-send.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { promisifyAll } = require('bluebird');

const config = require('./config');
const config = require('smart-config');
const { key, secret, region } = config.get('push');

const awsUtils = require('../helpers/aws-utils');
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/queue.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const debug = require('debug')('app:queue');
const config = require('./config');
const config = require('smart-config');
const queueConfig = config.get('amqp');
const queueClient = require('worque')(queueConfig.url);

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('source-map-support').install();

const app = require('./app');
const debug = require('debug')('app');
const config = require('./helpers/config');
const config = require('smart-config');
const port = config.get('port');
const server = app.listen(port);

Expand Down
5 changes: 3 additions & 2 deletions src/services/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
const mongoose = require('mongoose');
const Promise = require('bluebird');
const packageJson = require('../../package.json');
const { serverStatus } = require('node-helpers');

const recipient = require('./recipient');
const provider = require('./provider');
const recipientProfile = require('./recipient-profile');
const config = require('../helpers/config');
const config = require('smart-config');

module.exports = function () {
const app = this;

mongoose.connect(config.get('db').url);
mongoose.Promise = global.Promise;
mongoose.Promise = Promise;

app.configure(recipient);
app.configure(provider);
Expand Down
2 changes: 1 addition & 1 deletion test/api/mocked-server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require('../global-mocks');

const app = require('../../src/app');
const config = require('../../src/helpers/config');
const config = require('smart-config');
const port = config.get('port');
const server = app.listen(port);
const debug = require('debug')('app');
Expand Down

0 comments on commit 15b8b4f

Please sign in to comment.