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 {
// 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)
}
}
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)
}