diff options
Diffstat (limited to 'server/initializers/config.ts')
-rw-r--r-- | server/initializers/config.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 7fd77f3e8..950ca61bd 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { IConfig } from 'config' | 1 | import { IConfig } from 'config' |
2 | import { dirname, join } from 'path' | 2 | import { dirname, join } from 'path' |
3 | import { VideosRedundancy } from '../../shared/models' | 3 | import { VideosRedundancyStrategy } from '../../shared/models' |
4 | // Do not use barrels, remain constants as independent as possible | 4 | // Do not use barrels, remain constants as independent as possible |
5 | import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils' | 5 | import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils' |
6 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 6 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
@@ -284,11 +284,16 @@ function registerConfigChangedHandler (fun: Function) { | |||
284 | configChangedHandlers.push(fun) | 284 | configChangedHandlers.push(fun) |
285 | } | 285 | } |
286 | 286 | ||
287 | function isEmailEnabled () { | ||
288 | return !!CONFIG.SMTP.HOSTNAME && !!CONFIG.SMTP.PORT | ||
289 | } | ||
290 | |||
287 | // --------------------------------------------------------------------------- | 291 | // --------------------------------------------------------------------------- |
288 | 292 | ||
289 | export { | 293 | export { |
290 | CONFIG, | 294 | CONFIG, |
291 | registerConfigChangedHandler | 295 | registerConfigChangedHandler, |
296 | isEmailEnabled | ||
292 | } | 297 | } |
293 | 298 | ||
294 | // --------------------------------------------------------------------------- | 299 | // --------------------------------------------------------------------------- |
@@ -301,10 +306,10 @@ function getLocalConfigFilePath () { | |||
301 | if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}` | 306 | if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}` |
302 | if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}` | 307 | if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}` |
303 | 308 | ||
304 | return join(dirname(configSources[ 0 ].name), filename + '.json') | 309 | return join(dirname(configSources[0].name), filename + '.json') |
305 | } | 310 | } |
306 | 311 | ||
307 | function buildVideosRedundancy (objs: any[]): VideosRedundancy[] { | 312 | function buildVideosRedundancy (objs: any[]): VideosRedundancyStrategy[] { |
308 | if (!objs) return [] | 313 | if (!objs) return [] |
309 | 314 | ||
310 | if (!Array.isArray(objs)) return objs | 315 | if (!Array.isArray(objs)) return objs |
@@ -330,7 +335,7 @@ export function reloadConfig () { | |||
330 | 335 | ||
331 | function purge () { | 336 | function purge () { |
332 | for (const fileName in require.cache) { | 337 | for (const fileName in require.cache) { |
333 | if (-1 === fileName.indexOf(directory())) { | 338 | if (fileName.indexOf(directory()) === -1) { |
334 | continue | 339 | continue |
335 | } | 340 | } |
336 | 341 | ||