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

Commit 967bd1a

Browse files
authored
Merge pull request #281 from CoderDojo/staging
Staging
2 parents a4c7881 + 70e8f54 commit 967bd1a

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM mhart/alpine-node:0.10.48
22
MAINTAINER butlerx <[email protected]>
3+
ENV NODE_ENV=production
34
ARG DEP_VERSION=latest
45
RUN apk add --update git build-base python postgresql-client && \
56
mkdir -p /usr/src/app

dev.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM mhart/alpine-node:0.10.48
22
MAINTAINER butlerx <[email protected]>
3-
3+
ENV NODE_ENV=development
44
RUN apk add --update git build-base python postgresql-client && \
55
mkdir -p /usr/src/app /usr/src/cp-translations
66
COPY docker-entrypoint.sh /usr/src

profiles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ module.exports = function (options) {
478478
if (!_.contains(args.fileType, 'image')) return done(null, {ok: false, why: 'Avatar upload: file must be an image.'});
479479
if (file.length > 5242880) return done(null, {ok: false, why: 'Avatar upload: max file size of 5MB exceeded.'});
480480

481-
var buf = new Buffer(file, 'base64');
481+
var buf = new Buffer(file.data, 'base64');
482482
var type = buf.toString('hex', 0, 4);
483483
var types = ['ffd8ffe0', '89504e47', '47494638'];
484484
if (!_.contains(types, type)) return done(null, {ok: false, why: 'Avatar upload: file must be an image of type png, jpeg or gif.'});

service.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ config.log = log.log;
1414
var util = require('util');
1515
var dgram = require('dgram');
1616

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

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

2830
function shutdown (err) {
29-
if (err !== void 0 && err.stack !== void 0) {
30-
console.error(new Date().toString() + ' FATAL: UncaughtException, please report: ' + util.inspect(err));
31-
console.error(util.inspect(err.stack));
32-
console.trace();
31+
if (err !== undefined) {
32+
var error = {
33+
date: new Date().toString(),
34+
msg: err.stack !== undefined
35+
? 'FATAL: UncaughtException, please report: ' + util.inspect(err.stack)
36+
: 'FATAL: UncaughtException, no stack trace',
37+
err: util.inspect(err)
38+
};
39+
console.error(JSON.stringify(error));
40+
process.exit(1);
3341
}
3442
process.exit(0);
3543
}

0 commit comments

Comments
 (0)