Skip to content

Commit 637ada2

Browse files
NEXT-274 - added status service with maintenance flag and apiSecret
1 parent 7bb72aa commit 637ada2

File tree

16 files changed

+207
-20
lines changed

16 files changed

+207
-20
lines changed

config/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"url": "",
1414
"key": ""
1515
},
16+
"apiSecret": "TE9TqAk2xK[9EFJL",
1617
"sentry": {
1718
"dns": "SENTRY_DNS",
1819
"options": {

config/production.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"url": "THUMBOR_URL",
1919
"key": "THUMBOR_KEY"
2020
},
21+
"apiSecret": "APP_SECRET",
2122
"authentication": {
2223
"secret": "AUTH_SECRET",
2324
"jwt": {

server/models/status.model.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// status-model.js - A mongoose model
2+
//
3+
// See http://mongoosejs.com/docs/models.html
4+
// for more of what you can do here.
5+
6+
module.exports = function (app) {
7+
const mongooseClient = app.get('mongooseClient');
8+
const status = new mongooseClient.Schema({
9+
maintenance: { type: Boolean, default: false },
10+
updatedAt: { type: Date, default: Date.now }
11+
});
12+
13+
return mongooseClient.model('status', status);
14+
};

server/seeder/development/users-candos.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const seedHelpers = require('../../helper/seed-helpers');
22

33
module.exports = (seederstore) => {
44
let filter = ({type}) => type === 'cando';
5+
56
return {
67
services: [{
78
count: 80,

server/seeder/index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@ const _ = require('lodash');
1919
let configs = [...baseConfigs, ...developmentConfigs];
2020

2121
// seed service and add results to the seeder store
22-
const seedAndAssign = async (config, seeder) => {
22+
const seedAndAssign = async (config, seeder, app) => {
2323
const key = config.path;
24-
const res = await seeder.seed(config);
25-
if (_.isEmpty(seederstore[key])) {
26-
seederstore[key] = {};
24+
try {
25+
const res = await seeder.seed(config);
26+
if (_.isEmpty(seederstore[key])) {
27+
seederstore[key] = {};
28+
}
29+
_.merge(seederstore[key], _.mapKeys(res, '_id'));
30+
} catch (err) {
31+
app.error(err);
2732
}
28-
_.merge(seederstore[key], _.mapKeys(res, '_id'));
2933
};
3034

3135
module.exports = function (app = null, store = null) {
@@ -53,7 +57,7 @@ module.exports = function (app = null, store = null) {
5357
app.error('config was empty!');
5458
}
5559
await asyncForEach(config.services, async (service) => {
56-
await seedAndAssign(service, seeder);
60+
await seedAndAssign(service, seeder, app);
5761
});
5862
});
5963
app.info('>>>>>> SEEDING COMPLETED <<<<<<');
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* eslint no-console: 1 */
2-
console.warn('You are using the default filter for the admin service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console
3-
42
module.exports = function (data, connection, hook) { // eslint-disable-line no-unused-vars
5-
return data;
3+
return false;
64
};
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* eslint no-console: 1 */
2-
console.warn('You are using the default filter for the badges service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console
3-
42
module.exports = function (data, connection, hook) { // eslint-disable-line no-unused-vars
5-
return data;
3+
return false;
64
};
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* eslint no-console: 1 */
2-
console.warn('You are using the default filter for the images service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console
3-
42
module.exports = function (data, connection, hook) { // eslint-disable-line no-unused-vars
5-
return data;
3+
return false;
64
};

server/services/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const notifications = require('./notifications/notifications.service.js');
66
const emails = require('./emails/emails.service.js');
77
const categories = require('./categories/categories.service.js');
88
const uploads = require('./uploads/uploads.service.js');
9+
const status = require('./status/status.service.js');
910
const images = require('./images/images.service.js');
1011
const badges = require('./badges/badges.service.js');
1112
const emotions = require('./emotions/emotions.service.js');
@@ -20,6 +21,7 @@ module.exports = function () {
2021
const app = this; // eslint-disable-line no-unused-vars
2122
app.configure(authManagement);
2223
app.configure(users);
24+
app.configure(status);
2325
app.configure(contributions);
2426
app.configure(comments);
2527
app.configure(notifications);
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* eslint no-console: 1 */
2-
console.warn('You are using the default filter for the invites service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console
3-
42
module.exports = function (data, connection, hook) { // eslint-disable-line no-unused-vars
5-
return data;
3+
return false;
64
};

0 commit comments

Comments
 (0)