aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/config.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-11 15:38:53 +0200
committerChocobozzz <me@florianbigard.com>2019-04-11 15:38:53 +0200
commit8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98 (patch)
treee04f1da52f9377cf6ce820425c0de6e57ab57fc6 /server/initializers/config.ts
parent76062d9f96e06a23a2efc8a727ea9c5394d21466 (diff)
downloadPeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.tar.gz
PeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.tar.zst
PeerTube-8f0bc73d7d5f4c88cbc5588a0ece12b3855c8f98.zip
Add ability to limit videos history size
Diffstat (limited to 'server/initializers/config.ts')
-rw-r--r--server/initializers/config.ts11
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'
2import { dirname, join } from 'path' 2import { dirname, join } from 'path'
3import { VideosRedundancy } from '../../shared/models' 3import { 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
5import { buildPath, parseBytes, parseDuration, 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'
7import * as bytes from 'bytes' 7import * 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 })