]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/checker-after-init.ts
Fill documentation with required secret conf
[github/Chocobozzz/PeerTube.git] / server / initializers / checker-after-init.ts
index 74c82541ee70c3cd262b32fedf1389adeff636bf..c83fef425af8fc4ddd46ade9745000e54fff27e3 100644 (file)
@@ -1,7 +1,7 @@
 import config from 'config'
-import { uniq } from 'lodash'
 import { URL } from 'url'
 import { getFFmpegVersion } from '@server/helpers/ffmpeg'
+import { uniqify } from '@shared/core-utils'
 import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type'
 import { RecentlyAddedStrategy } from '../../shared/models/redundancy'
 import { isProdInstance, parseSemVersion } from '../helpers/core-utils'
@@ -42,6 +42,7 @@ function checkConfig () {
     logger.warn('services.csp-logger configuration has been renamed to csp.report_uri. Please update your configuration file.')
   }
 
+  checkSecretsConfig()
   checkEmailConfig()
   checkNSFWPolicyConfig()
   checkLocalRedundancyConfig()
@@ -103,6 +104,12 @@ export {
 
 // ---------------------------------------------------------------------------
 
+function checkSecretsConfig () {
+  if (!CONFIG.SECRETS.PEERTUBE) {
+    throw new Error('secrets.peertube is missing in config. Generate one using `openssl rand -hex 32`')
+  }
+}
+
 function checkEmailConfig () {
   if (!isEmailEnabled()) {
     if (CONFIG.SIGNUP.ENABLED && CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) {
@@ -141,7 +148,7 @@ function checkLocalRedundancyConfig () {
       }
     }
 
-    const filtered = uniq(redundancyVideos.map(r => r.strategy))
+    const filtered = uniqify(redundancyVideos.map(r => r.strategy))
     if (filtered.length !== redundancyVideos.length) {
       throw new Error('Redundancy video entries should have unique strategies')
     }