diff --git a/services/spelling/app/js/SpellingAPIManager.js b/services/spelling/app/js/SpellingAPIManager.js index e5e1c7896f..9a8dc1cc11 100644 --- a/services/spelling/app/js/SpellingAPIManager.js +++ b/services/spelling/app/js/SpellingAPIManager.js @@ -10,12 +10,13 @@ const ASpell = require('./ASpell') const LearnedWordsManager = require('./LearnedWordsManager') const { callbackify } = require('util') const OError = require('@overleaf/o-error') +const Settings = require('settings-sharelatex') // The max number of words checked in a single request const REQUEST_LIMIT = 10000 const SpellingAPIManager = { - whitelist: ['ShareLaTeX', 'sharelatex', 'LaTeX', 'http', 'https', 'www'], + whitelist: Settings.ignoredMisspellings, learnWord(token, request, callback) { if (callback == null) { diff --git a/services/spelling/config/settings.defaults.js b/services/spelling/config/settings.defaults.js index 702f39ec73..debb4225db 100644 --- a/services/spelling/config/settings.defaults.js +++ b/services/spelling/config/settings.defaults.js @@ -22,6 +22,10 @@ module.exports = { healthCheckUserId: '53c64d2fd68c8d000010bb5f', + ignoredMisspellings: process.env.IGNORED_MISSPELLINGS + ? process.env.IGNORED_MISSPELLINGS.split(',') + : ['ShareLaTeX', 'sharelatex', 'LaTeX', 'http', 'https', 'www'], + sentry: { dsn: process.env.SENTRY_DSN } diff --git a/services/spelling/test/unit/js/SpellingAPIManagerTests.js b/services/spelling/test/unit/js/SpellingAPIManagerTests.js index ab6ecf48a2..76d592720f 100644 --- a/services/spelling/test/unit/js/SpellingAPIManagerTests.js +++ b/services/spelling/test/unit/js/SpellingAPIManagerTests.js @@ -30,6 +30,7 @@ describe('SpellingAPIManager', function () { this.SpellingAPIManager = SandboxedModule.require(modulePath, { requires: { './ASpell': this.ASpell, + 'settings-sharelatex': { ignoredMisspellings: ['ShareLaTeX'] }, './LearnedWordsManager': this.LearnedWordsManager } })