Skip to content

Commit

Permalink
Merge pull request #297 from PastVu/notifier
Browse files Browse the repository at this point in the history
Manage notifications in config
  • Loading branch information
aeifn authored Nov 28, 2020
2 parents 2da576f + ff0d356 commit 9baa69c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
env: 'development', // Enviroment: development, testing, production
locales: ['en', 'ru'], // List of supported locales. First one is the default locale, if user transferred nothing
lang: 'ru', // Language: ru, en
notifier: false, // If true, send periodical emails to users

admin: {
email: '',
Expand Down
2 changes: 2 additions & 0 deletions config/local.config.js.docker-example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module.exports = function (config, appRequire) {
const _ = appRequire('lodash');

_.merge(config, {
// Send periodical emails to users depending on environment variable
notifier: process.env.NOTIFIER === 'true',
client: {
hostname: 'localhost',
},
Expand Down
1 change: 1 addition & 0 deletions config/local.config.js.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = function (config, appRequire) {
const _ = appRequire('lodash');

_.merge(config, {
notifier: true, // Send periodical emails to user
client: {
hostname: 'pastvu.local',
},
Expand Down
6 changes: 6 additions & 0 deletions controllers/subscr.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,12 @@ async function giveUserSubscriptions({ login, page = 1, type = 'photo' }) {
}

export const ready = (async () => {
if (! config.notifier) {
return;
} //Turn off notifier if disabled in config

logger.info('Proceeding to load notifier...');

try {
const data = await fsAsync.readFile(noticeTplPath, 'utf-8');

Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ services:
- store:/store
command: npm run app

notifier:
image: pastvu/node
depends_on:
- "app"
environment:
- NOTIFIER=true
volumes:
- .:/code
command: npm run app

uploader:
image: pastvu/node
expose:
Expand Down

0 comments on commit 9baa69c

Please sign in to comment.