X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Finstaller.ts;h=10b74b85fd50cb8b2334f52716d4e4fc2522b21d;hb=769d332177a5b02d5c2ffc134687d3b4ed65bae9;hp=3c5a77df9ac478e518b3b65f30a7fe6b4ca49db7;hpb=f981dae8617271a2dc713bb683951730b306e0c5;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 3c5a77df9..10b74b85f 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts @@ -1,12 +1,10 @@ -import { join } from 'path' -import * as config from 'config' import * as passwordGenerator from 'password-generator' import * as Promise from 'bluebird' import { database as db } from './database' import { USER_ROLES, CONFIG, LAST_MIGRATION_VERSION, CACHE } from './constants' import { clientsExist, usersExist } from './checker' -import { logger, createCertsIfNotExist, root, mkdirpPromise, rimrafPromise } from '../helpers' +import { logger, createCertsIfNotExist, mkdirpPromise, rimrafPromise } from '../helpers' function installApplication () { return db.sequelize.sync() @@ -40,12 +38,12 @@ function removeCacheDirectories () { } function createDirectoriesIfNotExist () { - const storages = CONFIG.STORAGE + const storage = CONFIG.STORAGE const cacheDirectories = CACHE.DIRECTORIES const tasks = [] - Object.keys(storages).forEach(key => { - const dir = storages[key] + Object.keys(storage).forEach(key => { + const dir = storage[key] tasks.push(mkdirpPromise(dir)) }) @@ -59,7 +57,7 @@ function createDirectoriesIfNotExist () { } function createOAuthClientIfNotExist () { - return clientsExist().then(exist => { + return clientsExist(db.OAuthClient).then(exist => { // Nothing to do, clients already exist if (exist === true) return undefined @@ -84,7 +82,7 @@ function createOAuthClientIfNotExist () { } function createOAuthAdminIfNotExist () { - return usersExist().then(exist => { + return usersExist(db.User).then(exist => { // Nothing to do, users already exist if (exist === true) return undefined @@ -114,7 +112,8 @@ function createOAuthAdminIfNotExist () { username, email, password, - role + role, + videoQuota: -1 } return db.User.create(userData, createOptions).then(createdUser => {