]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/installer.ts
Add ability to search video channels
[github/Chocobozzz/PeerTube.git] / server / initializers / installer.ts
index 324a2c2e5bdd4eefa0fca36f6627c2804db696bf..1926c40dd6dfeaba9ae48054032c73ed3af44a4e 100644 (file)
@@ -19,7 +19,7 @@ async function installApplication () {
     await createOAuthClientIfNotExist()
     await createOAuthAdminIfNotExist()
   } catch (err) {
-    logger.error('Cannot install application.', err)
+    logger.error('Cannot install application.', { err })
     process.exit(-1)
   }
 }
@@ -33,7 +33,8 @@ export {
 // ---------------------------------------------------------------------------
 
 function removeCacheDirectories () {
-  const cacheDirectories = CACHE.DIRECTORIES
+  const cacheDirectories = Object.keys(CACHE)
+    .map(k => CACHE[k].DIRECTORY)
 
   const tasks: Promise<any>[] = []
 
@@ -48,9 +49,10 @@ function removeCacheDirectories () {
 
 function createDirectoriesIfNotExist () {
   const storage = CONFIG.STORAGE
-  const cacheDirectories = CACHE.DIRECTORIES
+  const cacheDirectories = Object.keys(CACHE)
+                                 .map(k => CACHE[k].DIRECTORY)
 
-  const tasks = []
+  const tasks: Promise<string>[] = []
   for (const key of Object.keys(storage)) {
     const dir = storage[key]
     tasks.push(mkdirpPromise(dir))
@@ -112,7 +114,7 @@ async function createOAuthAdminIfNotExist () {
     // Our password is weak so do not validate it
     validatePassword = false
   } else {
-    password = passwordGenerator(8, true)
+    password = passwordGenerator(16, true)
   }
 
   const userData = {
@@ -120,6 +122,7 @@ async function createOAuthAdminIfNotExist () {
     email,
     password,
     role,
+    nsfwPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY,
     videoQuota: -1
   }
   const user = new UserModel(userData)
@@ -134,8 +137,6 @@ async function createApplicationIfNotExist () {
   // Nothing to do, application already exist
   if (exist === true) return undefined
 
-  logger.info('Creating Application table.')
-
   logger.info('Creating application account.')
 
   const application = await ApplicationModel.create({