X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Finstaller.ts;h=676f88653359e700784bf15ae208b34799561819;hb=60520c7c852b7430e09cdc68ac7ccfe506cbf417;hp=127449577a041c04c8720a2344651055dc50ccbe;hpb=6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 127449577..676f88653 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts @@ -2,11 +2,11 @@ import * as passwordGenerator from 'password-generator' import { UserRole } from '../../shared' import { logger } from '../helpers/logger' import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' -import { UserModel } from '../models/account/user' +import { UserModel } from '../models/user/user' import { ApplicationModel } from '../models/application/application' import { OAuthClientModel } from '../models/oauth/oauth-client' import { applicationExist, clientsExist, usersExist } from './checker-after-init' -import { FILES_CACHE, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants' +import { FILES_CACHE, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION, RESUMABLE_UPLOAD_DIRECTORY } from './constants' import { sequelizeTypescript } from './database' import { ensureDir, remove } from 'fs-extra' import { CONFIG } from './config' @@ -79,6 +79,9 @@ function createDirectoriesIfNotExist () { // Playlist directories tasks.push(ensureDir(HLS_STREAMING_PLAYLIST_DIRECTORY)) + // Resumable upload directory + tasks.push(ensureDir(RESUMABLE_UPLOAD_DIRECTORY)) + return Promise.all(tasks) } @@ -128,6 +131,8 @@ async function createOAuthAdminIfNotExist () { // Our password is weak so do not validate it validatePassword = false + } else if (process.env.PT_INITIAL_ROOT_PASSWORD) { + password = process.env.PT_INITIAL_ROOT_PASSWORD } else { password = passwordGenerator(16, true) } @@ -144,7 +149,7 @@ async function createOAuthAdminIfNotExist () { } const user = new UserModel(userData) - await createUserAccountAndChannelAndPlaylist(user, validatePassword) + await createUserAccountAndChannelAndPlaylist({ userToCreate: user, channelNames: undefined, validateUser: validatePassword }) logger.info('Username: ' + username) logger.info('User password: ' + password) }