X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Finitializers%2Finstaller.ts;h=cb58454cb650be3edcda509ea0353eda99797092;hb=1ebddadd0704812a4600c39cabe2268321e88331;hp=07af96b68982fc16fb3a300151863b218326c2ac;hpb=d74d29ad9e35929491cf37223398d2535ab23de0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 07af96b68..cb58454cb 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts @@ -6,9 +6,10 @@ import { UserModel } from '../models/account/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, CONFIG, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants' +import { FILES_CACHE, HLS_STREAMING_PLAYLIST_DIRECTORY, LAST_MIGRATION_VERSION } from './constants' import { sequelizeTypescript } from './database' -import { remove, ensureDir } from 'fs-extra' +import { ensureDir, remove } from 'fs-extra' +import { CONFIG } from './config' async function installApplication () { try { @@ -127,6 +128,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) } @@ -143,7 +146,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) }