Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #281 from CoderDojo/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
Wardormeur authored Nov 20, 2017
2 parents a4c7881 + 70e8f54 commit 967bd1a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM mhart/alpine-node:0.10.48
MAINTAINER butlerx <[email protected]>
ENV NODE_ENV=production
ARG DEP_VERSION=latest
RUN apk add --update git build-base python postgresql-client && \
mkdir -p /usr/src/app
Expand Down
2 changes: 1 addition & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM mhart/alpine-node:0.10.48
MAINTAINER butlerx <[email protected]>

ENV NODE_ENV=development
RUN apk add --update git build-base python postgresql-client && \
mkdir -p /usr/src/app /usr/src/cp-translations
COPY docker-entrypoint.sh /usr/src
Expand Down
2 changes: 1 addition & 1 deletion profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ module.exports = function (options) {
if (!_.contains(args.fileType, 'image')) return done(null, {ok: false, why: 'Avatar upload: file must be an image.'});
if (file.length > 5242880) return done(null, {ok: false, why: 'Avatar upload: max file size of 5MB exceeded.'});

var buf = new Buffer(file, 'base64');
var buf = new Buffer(file.data, 'base64');
var type = buf.toString('hex', 0, 4);
var types = ['ffd8ffe0', '89504e47', '47494638'];
if (!_.contains(types, type)) return done(null, {ok: false, why: 'Avatar upload: file must be an image of type png, jpeg or gif.'});
Expand Down
18 changes: 13 additions & 5 deletions service.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ config.log = log.log;
var util = require('util');
var dgram = require('dgram');

seneca.log.info('using config', JSON.stringify(config, null, 4));
if (process.env.NODE_ENV !== 'production') {
seneca.log.info('using config', JSON.stringify(config, null, 4));
}

seneca.options(config);
seneca.decorate('customValidatorLogFormatter', require('./lib/custom-validator-log-formatter'));
Expand All @@ -26,10 +28,16 @@ if (process.env.MAILTRAP_ENABLED === 'true') {
}

function shutdown (err) {
if (err !== void 0 && err.stack !== void 0) {
console.error(new Date().toString() + ' FATAL: UncaughtException, please report: ' + util.inspect(err));
console.error(util.inspect(err.stack));
console.trace();
if (err !== undefined) {
var error = {
date: new Date().toString(),
msg: err.stack !== undefined
? 'FATAL: UncaughtException, please report: ' + util.inspect(err.stack)
: 'FATAL: UncaughtException, no stack trace',
err: util.inspect(err)
};
console.error(JSON.stringify(error));
process.exit(1);
}
process.exit(0);
}
Expand Down

0 comments on commit 967bd1a

Please sign in to comment.