Skip to content

Commit

Permalink
log fixes; report configuration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sanoel committed Aug 9, 2023
1 parent d102d3a commit 1c66c0b
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 88 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qlever-llc/fl-sync",
"version": "1.4.8",
"version": "1.4.9",
"description": "A Trellis microservice to sync Food Logiq data to a Trellis cloud",
"main": "dist/index.ts",
"scripts": {
Expand Down
65 changes: 37 additions & 28 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,36 +148,45 @@ const config = convict({
env: 'HANDLE_INCOMPLETE_INTERVAL',
arg: 'handleIncompleteInterval',
},
reportInterval: {
doc: 'Time interval for reports to be generated.',
format: Number,
default: 86_400_000,
env: 'REPORT_INTERVAL',
arg: 'reportInterval',
},
reportEmail: {
doc: 'Email addresses to send reports to',
format: String,
default: null,
env: 'REPORT_EMAIL',
arg: 'reportEmail',
},
reportCcEmail: {
doc: 'Email address to cc reports to',
format: String,
default: null,
env: 'REPORT_CC_EMAIL',
arg: 'reportCcEmail',
},
reportReplyToEmail: {
doc: 'reply to email listed for the report',
format: String,
default: null,
env: 'REPORT_REPLYTO_EMAIL',
arg: 'reportReplyToEmail',
reports: {
docFrequency: {
doc: 'CRON frequency for reports to be generated.',
format: String,
default: '0 0 0 * * 1',
env: 'DOC_REPORT_FREQ',
arg: 'docFrequency',
},
vendorFrequency: {
doc: 'CRON frequency for reports to be generated.',
format: String,
default: '0 0 0 * * 2',
env: 'VENDOR_REPORT_FREQ',
arg: 'vendorFrequency',
},
email: {
doc: 'Email addresses to send reports to',
format: String,
default: null,
env: 'REPORT_EMAIL',
arg: 'reportEmail',
},
ccEmail: {
doc: 'Email address to cc reports to',
format: String,
default: null,
env: 'REPORT_CC_EMAIL',
arg: 'reportCcEmail',
},
replyToEmail: {
doc: 'reply to email listed for the report',
format: String,
default: null,
env: 'REPORT_REPLYTO_EMAIL',
arg: 'reportReplyToEmail',
},
},
},
foodlogiq: {
'foodlogiq': {
'interval': {
doc: 'polling interval',
format: Number,
Expand Down
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ const JUST_TPS = config.get('trellis.justTps');
const CO_ID = config.get('foodlogiq.community.owner.id');
const COMMUNITY_ID = config.get('foodlogiq.community.id');
const CONCURRENCY = config.get('trellis.concurrency');
// Const HANDLE_INCOMPLETE_INTERVAL = config.get('trellis.handleIncompleteInterval');
// const REPORT_INTERVAL = config.get('trellis.handleIncompleteInterval');
const INTERVAL_MS = config.get('foodlogiq.interval') * 1000; // FL polling interval
const SERVICE_NAME = config.get('service.name');
const SERVICE_PATH = `/bookmarks/services/${SERVICE_NAME}`;
const FL_FORCE_WRITE = config.get('foodlogiq.force_write');
const REPORT_EMAIL = config.get('trellis.reportEmail');
const REPORT_CC_EMAIL = config.get('trellis.reportCcEmail');
const REPORT_REPLYTO_EMAIL = config.get('trellis.reportReplyToEmail');
const DOC_FREQUENCY = config.get('trellis.reports.docFrequency');
const VENDOR_FREQUENCY = config.get('trellis.reports.vendorFrequency');
const REPORT_EMAIL = config.get('trellis.reports.email');
const REPORT_CC_EMAIL = config.get('trellis.reports.ccEmail');
const REPORT_REPLYTO_EMAIL = config.get('trellis.reports.replyToEmail');
const services = config.get('services');
const skipQueueOnStartup = config.get('skipQueueOnStartup');

Expand Down Expand Up @@ -552,14 +552,14 @@ export async function initialize({
svc.addReport({
name: 'fl-sync-report',
reportConfig: docReportConfig,
frequency: `0 0 0 * * *`,
frequency: DOC_FREQUENCY,
email: prepEmail,
type: 'document-mirrored',
});
svc.addReport({
name: 'businesses-report',
reportConfig: tpReportConfig,
frequency: `0 0 0 * * 1`,
frequency: VENDOR_FREQUENCY,
email: prepTpEmail,
type: 'business-lookup',
filter: tpReportFilter,
Expand Down
Loading

0 comments on commit 1c66c0b

Please sign in to comment.