]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/config.ts
Move to eslint
[github/Chocobozzz/PeerTube.git] / server / initializers / config.ts
index 95b069533a9de6fce7a278c8ad1328fe229aeb2b..75372fa4eaa7f4208957fcbec510b443ad4cd708 100644 (file)
@@ -1,6 +1,6 @@
 import { IConfig } from 'config'
 import { dirname, join } from 'path'
-import { VideosRedundancy } from '../../shared/models'
+import { VideosRedundancyStrategy } from '../../shared/models'
 // Do not use barrels, remain constants as independent as possible
 import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils'
 import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
@@ -191,7 +191,11 @@ const CONFIG = {
   IMPORT: {
     VIDEOS: {
       HTTP: {
-        get ENABLED () { return config.get<boolean>('import.videos.http.enabled') }
+        get ENABLED () { return config.get<boolean>('import.videos.http.enabled') },
+        PROXY: {
+          get ENABLED () { return config.get<boolean>('import.videos.http.proxy.enabled') },
+          get URL () { return config.get<string>('import.videos.http.proxy.url') }
+        }
       },
       TORRENT: {
         get ENABLED () { return config.get<boolean>('import.videos.torrent.enabled') }
@@ -297,10 +301,10 @@ function getLocalConfigFilePath () {
   if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}`
   if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}`
 
-  return join(dirname(configSources[ 0 ].name), filename + '.json')
+  return join(dirname(configSources[0].name), filename + '.json')
 }
 
-function buildVideosRedundancy (objs: any[]): VideosRedundancy[] {
+function buildVideosRedundancy (objs: any[]): VideosRedundancyStrategy[] {
   if (!objs) return []
 
   if (!Array.isArray(objs)) return objs
@@ -326,7 +330,7 @@ export function reloadConfig () {
 
   function purge () {
     for (const fileName in require.cache) {
-      if (-1 === fileName.indexOf(directory())) {
+      if (fileName.indexOf(directory()) === -1) {
         continue
       }