diff --git a/CHANGELOG.md b/CHANGELOG.md index 41e5fe4d7..433d47f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## Unreleased [minor] + +_Full changeset and discussions: [#1052](https://github.com/OpenTermsArchive/engine/pull/1052)._ + +> Development of this release was supported by the [French Ministry for Foreign Affairs](https://www.diplomatie.gouv.fr/fr/politique-etrangere-de-la-france/diplomatie-numerique/) through its ministerial [State Startups incubator](https://beta.gouv.fr/startups/open-terms-archive.html) under the aegis of the Ambassador for Digital Affairs. + +### Changed + +- **Breaking:** Base the loading of the Notifier module on the presence of required configuration, not on the environment; only define the `SENDINBLUE_API_KEY` environment variable if you want the Notifier to be loaded, avoid relying on `NODE_ENV=production` ## 0.35.0 - 2024-02-14 diff --git a/src/index.js b/src/index.js index 6c8873a71..dd31458c2 100644 --- a/src/index.js +++ b/src/index.js @@ -38,8 +38,10 @@ export default async function track({ services, types, extractOnly, schedule }) return; } - if (process.env.NODE_ENV === 'production') { + if (process.env.SENDINBLUE_API_KEY) { archivist.attach(new Notifier(archivist.services)); + } else { + logger.warn('Environment variable "SENDINBLUE_API_KEY" was not found; the Notifier module will be ignored'); } if (process.env.GITHUB_TOKEN) { @@ -49,8 +51,10 @@ export default async function track({ services, types, extractOnly, schedule }) await reporter.initialize(); archivist.attach(reporter); } else { - logger.warn('Configuration key "reporter.githubIssues.repositories.declarations" was not found; the Reporter module will be ignored\n'); + logger.warn('Configuration key "reporter.githubIssues.repositories.declarations" was not found; the Reporter module will be ignored'); } + } else { + logger.warn('Environment variable "GITHUB_TOKEN" was not found; the Notifier module will be ignored'); } if (!schedule) { diff --git a/src/logger/index.js b/src/logger/index.js index e7ca02073..1cb73f7c0 100644 --- a/src/logger/index.js +++ b/src/logger/index.js @@ -34,7 +34,7 @@ const consoleTransport = new winston.transports.Console(); const transports = [consoleTransport]; -if (config.get('logger.sendMailOnError')) { +if (process.env.SMTP_PASSWORD && config.get('logger.sendMailOnError')) { const mailerOptions = { to: config.get('logger.sendMailOnError.to'), from: config.get('logger.sendMailOnError.from'),