diff options
Diffstat (limited to 'server/initializers/config.ts')
-rw-r--r-- | server/initializers/config.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 8dd62cba8..1f374dea9 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -2,7 +2,7 @@ import { IConfig } from 'config' | |||
2 | import { dirname, join } from 'path' | 2 | import { dirname, join } from 'path' |
3 | import { VideosRedundancy } from '../../shared/models' | 3 | import { VideosRedundancy } 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, parseDuration, 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 | 8 | ||
@@ -80,7 +80,7 @@ const CONFIG = { | |||
80 | }, | 80 | }, |
81 | REDUNDANCY: { | 81 | REDUNDANCY: { |
82 | VIDEOS: { | 82 | VIDEOS: { |
83 | CHECK_INTERVAL: parseDuration(config.get<string>('redundancy.videos.check_interval')), | 83 | CHECK_INTERVAL: parseDurationToMs(config.get<string>('redundancy.videos.check_interval')), |
84 | STRATEGIES: buildVideosRedundancy(config.get<any[]>('redundancy.videos.strategies')) | 84 | STRATEGIES: buildVideosRedundancy(config.get<any[]>('redundancy.videos.strategies')) |
85 | } | 85 | } |
86 | }, | 86 | }, |
@@ -94,6 +94,11 @@ const CONFIG = { | |||
94 | PRIVATE: config.get<boolean>('tracker.private'), | 94 | PRIVATE: config.get<boolean>('tracker.private'), |
95 | REJECT_TOO_MANY_ANNOUNCES: config.get<boolean>('tracker.reject_too_many_announces') | 95 | REJECT_TOO_MANY_ANNOUNCES: config.get<boolean>('tracker.reject_too_many_announces') |
96 | }, | 96 | }, |
97 | HISTORY: { | ||
98 | VIDEOS: { | ||
99 | MAX_AGE: parseDurationToMs(config.get('history.videos.max_age')) | ||
100 | } | ||
101 | }, | ||
97 | ADMIN: { | 102 | ADMIN: { |
98 | get EMAIL () { return config.get<string>('admin.email') } | 103 | get EMAIL () { return config.get<string>('admin.email') } |
99 | }, | 104 | }, |
@@ -216,7 +221,7 @@ function buildVideosRedundancy (objs: any[]): VideosRedundancy[] { | |||
216 | 221 | ||
217 | return objs.map(obj => { | 222 | return objs.map(obj => { |
218 | return Object.assign({}, obj, { | 223 | return Object.assign({}, obj, { |
219 | minLifetime: parseDuration(obj.min_lifetime), | 224 | minLifetime: parseDurationToMs(obj.min_lifetime), |
220 | size: bytes.parse(obj.size), | 225 | size: bytes.parse(obj.size), |
221 | minViews: obj.min_views | 226 | minViews: obj.min_views |
222 | }) | 227 | }) |