aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/installer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/installer.ts')
-rw-r--r--server/initializers/installer.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts
index 5221b81a5..c3521a9e4 100644
--- a/server/initializers/installer.ts
+++ b/server/initializers/installer.ts
@@ -3,8 +3,8 @@ import { UserRole } from '../../shared'
3import { logger, mkdirpPromise, rimrafPromise } from '../helpers' 3import { logger, mkdirpPromise, rimrafPromise } from '../helpers'
4import { createUserAccountAndChannel } from '../lib' 4import { createUserAccountAndChannel } from '../lib'
5import { createLocalAccount } from '../lib/user' 5import { createLocalAccount } from '../lib/user'
6import { clientsExist, usersExist } from './checker' 6import { applicationExist, clientsExist, usersExist } from './checker'
7import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' 7import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants'
8 8
9import { database as db } from './database' 9import { database as db } from './database'
10 10
@@ -128,9 +128,13 @@ async function createOAuthAdminIfNotExist () {
128} 128}
129 129
130async function createApplicationIfNotExist () { 130async function createApplicationIfNotExist () {
131 const exist = await applicationExist(db.Application)
132 // Nothing to do, application already exist
133 if (exist === true) return undefined
134
131 logger.info('Creating Application table.') 135 logger.info('Creating Application table.')
132 const applicationInstance = await db.Application.create({ migrationVersion: LAST_MIGRATION_VERSION }) 136 const applicationInstance = await db.Application.create({ migrationVersion: LAST_MIGRATION_VERSION })
133 137
134 logger.info('Creating application account.') 138 logger.info('Creating application account.')
135 return createLocalAccount('peertube', null, applicationInstance.id, undefined) 139 return createLocalAccount(SERVER_ACCOUNT_NAME, null, applicationInstance.id, undefined)
136} 140}