-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use multi db and multi service for SaaS * Fix tests * Fix tests running in docker * Fix missed location group usage Use location group in all tests * Add request logging * Debug pingeon * Use node 7 Remove babel * Pass pubsub config in response Story https://www.pivotaltracker.com/story/show/144101103 * Fix error handler * Version bump * Fix mocha tests running * Fix node version for test image * Fix fanout error handler * Update pubsub docs * Version bump
- Loading branch information
1 parent
9cd44c9
commit bf23955
Showing
73 changed files
with
592 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
FROM mhart/alpine-node:4 | ||
FROM node:7.9.0-alpine | ||
|
||
# Create app directory | ||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
COPY . /usr/src/app | ||
|
||
RUN apk add --no-cache make gcc g++ python | ||
RUN npm install | ||
RUN npm prune --production | ||
RUN npm install --production | ||
|
||
EXPOSE 8080 | ||
CMD [ "npm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
FROM musedlab/alpine-node | ||
FROM node:7.9.0-alpine | ||
|
||
MAINTAINER Vanya Andreychuk "[email protected]" | ||
|
||
RUN apk add --update curl make gcc g++ python \ | ||
&& mkdir -p /var/www/html | ||
|
||
WORKDIR /var/www/html | ||
|
||
COPY .cache /var/www/html | ||
|
||
COPY run.sh /root/run.sh | ||
|
||
RUN npm install \ | ||
&& npm run build \ | ||
&& npm prune --production | ||
RUN npm install --production | ||
|
||
EXPOSE 8080 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
const compress = require('compression'); | ||
const cors = require('cors'); | ||
const { locationGroupHeader } = require('feathers-lg-multi-service-mongoose'); | ||
const beforeRequest = require('./middleware/before-request'); | ||
const afterRequest = require('./middleware/after-request'); | ||
const db = require('./db'); | ||
const feathers = require('feathers'); | ||
const hooks = require('feathers-hooks'); | ||
const rest = require('feathers-rest'); | ||
const bodyParser = require('body-parser'); | ||
const middleware = require('./middleware'); | ||
const services = require('./services'); | ||
const sentry = require('./helpers/sentry'); | ||
|
||
const app = feathers(); | ||
app.use(compress()) | ||
.options('*', cors()) | ||
.use(cors()) | ||
.use(bodyParser.json()) | ||
.use(bodyParser.urlencoded({ extended: true })) | ||
.use(sentry.requestHandler) | ||
|
||
app | ||
.configure(beforeRequest) | ||
.configure(hooks()) | ||
.configure(rest()) | ||
.configure(db) | ||
.use(locationGroupHeader( | ||
{ defaultLocationGroup: '' } | ||
)) | ||
.configure(services) | ||
.configure(middleware) | ||
.use(sentry.errorHandler); | ||
.configure(afterRequest); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const multiConnect = require('mongoose-multi-connect'); | ||
const mongoose = require('mongoose'); | ||
const Promise = require('bluebird'); | ||
const requireDir = require('require-dir'); | ||
const renameId = require('mongoose-rename-id'); | ||
const { db: { url } } = require('smart-config'); | ||
const { mapValues } = require('lodash'); | ||
|
||
const schemas = mapValues(requireDir('./schemas'), (schema) => { | ||
schema.plugin(renameId({ mongoose, newIdName: 'id' })); | ||
return schema; | ||
}); | ||
|
||
mongoose.Promise = Promise; | ||
multiConnect.init({ mongoose, url, schemas }); | ||
|
||
module.exports = () => multiConnect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { Schema } = require('mongoose'); | ||
|
||
module.exports = new Schema({ | ||
firstName: String, | ||
lastName: String, | ||
gender: { | ||
type: String, | ||
enum: ['male', 'female'] | ||
}, | ||
lastActivity: Date, | ||
appId: Schema.Types.ObjectId | ||
}, { versionKey: false }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
const defaultVars = require('smart-config').get('email.defaultVars') || {}; | ||
const getRecipientNameParts = require('./get-recipient-name-parts'); | ||
|
||
module.exports = async function ({ vars = {}, recipientId, toEmail }) { | ||
const nameParts = await getRecipientNameParts(recipientId); | ||
const generatedVars = { | ||
currentYear: new Date().getFullYear(), | ||
...nameParts, toEmail | ||
}; | ||
return { ...defaultVars, ...generatedVars, ...vars }; | ||
module.exports = async function ({ vars = {}, recipientId, toEmail, locationGroup }) { | ||
const nameParts = await getRecipientNameParts(recipientId, locationGroup); | ||
const generatedVars = Object.assign({ | ||
currentYear: new Date().getFullYear(), toEmail | ||
}, nameParts); | ||
return Object.assign({}, defaultVars, generatedVars, vars); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { db: { url } } = require('smart-config'); | ||
const _ = require('lodash'); | ||
|
||
module.exports = function (schemaPath) { | ||
const schema = require(schemaPath); | ||
const collectionName = _.last(schemaPath.split('/')); | ||
return { schema, collectionName, dbUrl: url }; | ||
}; |
Oops, something went wrong.