X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Finstaller.ts;h=1926c40dd6dfeaba9ae48054032c73ed3af44a4e;hb=f37dc0dd14d9ce0b59c454c2c1b935fcbe9727e9;hp=324a2c2e5bdd4eefa0fca36f6627c2804db696bf;hpb=2ccaeeb341ffe8c2609039bf4c6d8835b4650316;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 324a2c2e5..1926c40dd 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts @@ -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[] = [] @@ -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[] = [] 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({