aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/config.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/config.ts')
-rw-r--r--server/initializers/config.ts15
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 @@
1import { IConfig } from 'config' 1import { IConfig } from 'config'
2import { dirname, join } from 'path' 2import { dirname, join } from 'path'
3import { VideosRedundancy } from '../../shared/models' 3import { 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
5import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils' 5import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils'
6import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 6import { 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
287function isEmailEnabled () {
288 return !!CONFIG.SMTP.HOSTNAME && !!CONFIG.SMTP.PORT
289}
290
287// --------------------------------------------------------------------------- 291// ---------------------------------------------------------------------------
288 292
289export { 293export {
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
307function buildVideosRedundancy (objs: any[]): VideosRedundancy[] { 312function 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