diff options
author | BRAINS YUM <43896676+McFlat@users.noreply.github.com> | 2018-10-13 01:43:55 -0500 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-13 08:43:55 +0200 |
commit | 0e5ff97f6fdf9a4cebe5a15f5a390380465803ad (patch) | |
tree | e3f69adb2b8a910ef750b44972ea59944aa9ca7c /server/initializers | |
parent | 6e5a785b20230ff5457632361a893d814b53c95e (diff) | |
download | PeerTube-0e5ff97f6fdf9a4cebe5a15f5a390380465803ad.tar.gz PeerTube-0e5ff97f6fdf9a4cebe5a15f5a390380465803ad.tar.zst PeerTube-0e5ff97f6fdf9a4cebe5a15f5a390380465803ad.zip |
add parseBytes utility function and tests (#1239)
* add parseBytes utility function and tests
make it parse TB MB
fix parseBytes; * 1024
test bytes too, and make parseByte to parse quotas
add test in travis.sh in misc
* fix parseBytes and test to pass linting
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index a3e5f5dd2..e08fd75cd 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -5,7 +5,7 @@ import { ActivityPubActorType } from '../../shared/models/activitypub' | |||
5 | import { FollowState } from '../../shared/models/actors' | 5 | import { FollowState } from '../../shared/models/actors' |
6 | import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' | 6 | import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' |
7 | // Do not use barrels, remain constants as independent as possible | 7 | // Do not use barrels, remain constants as independent as possible |
8 | import { buildPath, isTestInstance, parseDuration, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' | 8 | import { buildPath, isTestInstance, parseDuration, parseBytes, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' |
9 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 9 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
10 | import { invert } from 'lodash' | 10 | import { invert } from 'lodash' |
11 | import { CronRepeatOptions, EveryRepeatOptions } from 'bull' | 11 | import { CronRepeatOptions, EveryRepeatOptions } from 'bull' |
@@ -232,8 +232,8 @@ const CONFIG = { | |||
232 | } | 232 | } |
233 | }, | 233 | }, |
234 | USER: { | 234 | USER: { |
235 | get VIDEO_QUOTA () { return config.get<number>('user.video_quota') }, | 235 | get VIDEO_QUOTA () { return parseBytes(config.get<number>('user.video_quota')) }, |
236 | get VIDEO_QUOTA_DAILY () { return config.get<number>('user.video_quota_daily') } | 236 | get VIDEO_QUOTA_DAILY () { return parseBytes(config.get<number>('user.video_quota_daily')) } |
237 | }, | 237 | }, |
238 | TRANSCODING: { | 238 | TRANSCODING: { |
239 | get ENABLED () { return config.get<boolean>('transcoding.enabled') }, | 239 | get ENABLED () { return config.get<boolean>('transcoding.enabled') }, |