diff options
Diffstat (limited to 'server/initializers/config.ts')
-rw-r--r-- | server/initializers/config.ts | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index dadda2a77..f2e9f7088 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -1,12 +1,13 @@ | |||
1 | import bytes from 'bytes' | 1 | import bytes from 'bytes' |
2 | import { IConfig } from 'config' | 2 | import { IConfig } from 'config' |
3 | import decache from 'decache' | ||
4 | import { dirname, join } from 'path' | 3 | import { dirname, join } from 'path' |
4 | import { decacheModule } from '@server/helpers/decache' | ||
5 | import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type' | 5 | import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type' |
6 | import { BroadcastMessageLevel } from '@shared/models/server' | 6 | import { BroadcastMessageLevel } from '@shared/models/server' |
7 | import { VideosRedundancyStrategy } from '../../shared/models' | 7 | import { VideoPrivacy, VideosRedundancyStrategy } from '../../shared/models' |
8 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 8 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
9 | import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils' | 9 | import { buildPath, root } from '../../shared/core-utils' |
10 | import { parseBytes, parseDurationToMs } from '../helpers/core-utils' | ||
10 | 11 | ||
11 | // Use a variable to reload the configuration if we need | 12 | // Use a variable to reload the configuration if we need |
12 | let config: IConfig = require('config') | 13 | let config: IConfig = require('config') |
@@ -63,6 +64,28 @@ const CONFIG = { | |||
63 | MINIATURE: { | 64 | MINIATURE: { |
64 | get PREFER_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.prefer_author_display_name') } | 65 | get PREFER_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.prefer_author_display_name') } |
65 | } | 66 | } |
67 | }, | ||
68 | MENU: { | ||
69 | LOGIN: { | ||
70 | get REDIRECT_ON_SINGLE_EXTERNAL_AUTH () { return config.get<boolean>('client.menu.login.redirect_on_single_external_auth') } | ||
71 | } | ||
72 | } | ||
73 | }, | ||
74 | |||
75 | DEFAULTS: { | ||
76 | PUBLISH: { | ||
77 | DOWNLOAD_ENABLED: config.get<boolean>('defaults.publish.download_enabled'), | ||
78 | COMMENTS_ENABLED: config.get<boolean>('defaults.publish.comments_enabled'), | ||
79 | PRIVACY: config.get<VideoPrivacy>('defaults.publish.privacy'), | ||
80 | LICENCE: config.get<number>('defaults.publish.licence') | ||
81 | }, | ||
82 | P2P: { | ||
83 | WEBAPP: { | ||
84 | ENABLED: config.get<boolean>('defaults.p2p.webapp.enabled') | ||
85 | }, | ||
86 | EMBED: { | ||
87 | ENABLED: config.get<boolean>('defaults.p2p.embed.enabled') | ||
88 | } | ||
66 | } | 89 | } |
67 | }, | 90 | }, |
68 | 91 | ||
@@ -497,7 +520,7 @@ export function reloadConfig () { | |||
497 | delete require.cache[fileName] | 520 | delete require.cache[fileName] |
498 | } | 521 | } |
499 | 522 | ||
500 | decache('config') | 523 | decacheModule('config') |
501 | } | 524 | } |
502 | 525 | ||
503 | purge() | 526 | purge() |