diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/checker-after-init.ts | 8 | ||||
-rw-r--r-- | server/initializers/checker-before-init.ts | 3 | ||||
-rw-r--r-- | server/initializers/config.ts | 6 |
3 files changed, 16 insertions, 1 deletions
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts index bc4aae957..a57d552df 100644 --- a/server/initializers/checker-after-init.ts +++ b/server/initializers/checker-after-init.ts | |||
@@ -11,6 +11,7 @@ import { RecentlyAddedStrategy } from '../../shared/models/redundancy' | |||
11 | import { isArray } from '../helpers/custom-validators/misc' | 11 | import { isArray } from '../helpers/custom-validators/misc' |
12 | import { uniq } from 'lodash' | 12 | import { uniq } from 'lodash' |
13 | import { WEBSERVER } from './constants' | 13 | import { WEBSERVER } from './constants' |
14 | import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type' | ||
14 | 15 | ||
15 | async function checkActivityPubUrls () { | 16 | async function checkActivityPubUrls () { |
16 | const actor = await getServerActor() | 17 | const actor = await getServerActor() |
@@ -87,6 +88,13 @@ function checkConfig () { | |||
87 | return 'Videos redundancy should be an array (you must uncomment lines containing - too)' | 88 | return 'Videos redundancy should be an array (you must uncomment lines containing - too)' |
88 | } | 89 | } |
89 | 90 | ||
91 | // Remote redundancies | ||
92 | const acceptFrom = CONFIG.REMOTE_REDUNDANCY.VIDEOS.ACCEPT_FROM | ||
93 | const acceptFromValues = new Set<VideoRedundancyConfigFilter>([ 'nobody', 'anybody', 'followings' ]) | ||
94 | if (acceptFromValues.has(acceptFrom) === false) { | ||
95 | return 'remote_redundancy.videos.accept_from has an incorrect value' | ||
96 | } | ||
97 | |||
90 | // Check storage directory locations | 98 | // Check storage directory locations |
91 | if (isProdInstance()) { | 99 | if (isProdInstance()) { |
92 | const configStorage = config.get('storage') | 100 | const configStorage = config.get('storage') |
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index a75f2cec2..064d89a4d 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -31,7 +31,8 @@ function checkMissedConfig () { | |||
31 | 'tracker.enabled', 'tracker.private', 'tracker.reject_too_many_announces', | 31 | 'tracker.enabled', 'tracker.private', 'tracker.reject_too_many_announces', |
32 | 'history.videos.max_age', 'views.videos.remote.max_age', | 32 | 'history.videos.max_age', 'views.videos.remote.max_age', |
33 | 'rates_limit.login.window', 'rates_limit.login.max', 'rates_limit.ask_send_email.window', 'rates_limit.ask_send_email.max', | 33 | 'rates_limit.login.window', 'rates_limit.login.max', 'rates_limit.ask_send_email.window', 'rates_limit.ask_send_email.max', |
34 | 'theme.default' | 34 | 'theme.default', |
35 | 'remote_redundancy.videos.accept_from' | ||
35 | ] | 36 | ] |
36 | const requiredAlternatives = [ | 37 | const requiredAlternatives = [ |
37 | [ // set | 38 | [ // set |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 3c07624e8..2c4d26a9e 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -5,6 +5,7 @@ import { VideosRedundancyStrategy } from '../../shared/models' | |||
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' |
7 | import * as bytes from 'bytes' | 7 | import * as bytes from 'bytes' |
8 | import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type' | ||
8 | 9 | ||
9 | // Use a variable to reload the configuration if we need | 10 | // Use a variable to reload the configuration if we need |
10 | let config: IConfig = require('config') | 11 | let config: IConfig = require('config') |
@@ -117,6 +118,11 @@ const CONFIG = { | |||
117 | STRATEGIES: buildVideosRedundancy(config.get<any[]>('redundancy.videos.strategies')) | 118 | STRATEGIES: buildVideosRedundancy(config.get<any[]>('redundancy.videos.strategies')) |
118 | } | 119 | } |
119 | }, | 120 | }, |
121 | REMOTE_REDUNDANCY: { | ||
122 | VIDEOS: { | ||
123 | ACCEPT_FROM: config.get<VideoRedundancyConfigFilter>('remote_redundancy.videos.accept_from') | ||
124 | } | ||
125 | }, | ||
120 | CSP: { | 126 | CSP: { |
121 | ENABLED: config.get<boolean>('csp.enabled'), | 127 | ENABLED: config.get<boolean>('csp.enabled'), |
122 | REPORT_ONLY: config.get<boolean>('csp.report_only'), | 128 | REPORT_ONLY: config.get<boolean>('csp.report_only'), |