diff options
Diffstat (limited to 'server/initializers/installer.ts')
-rw-r--r-- | server/initializers/installer.ts | 10 |
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' | |||
3 | import { logger, mkdirpPromise, rimrafPromise } from '../helpers' | 3 | import { logger, mkdirpPromise, rimrafPromise } from '../helpers' |
4 | import { createUserAccountAndChannel } from '../lib' | 4 | import { createUserAccountAndChannel } from '../lib' |
5 | import { createLocalAccount } from '../lib/user' | 5 | import { createLocalAccount } from '../lib/user' |
6 | import { clientsExist, usersExist } from './checker' | 6 | import { applicationExist, clientsExist, usersExist } from './checker' |
7 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' | 7 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants' |
8 | 8 | ||
9 | import { database as db } from './database' | 9 | import { database as db } from './database' |
10 | 10 | ||
@@ -128,9 +128,13 @@ async function createOAuthAdminIfNotExist () { | |||
128 | } | 128 | } |
129 | 129 | ||
130 | async function createApplicationIfNotExist () { | 130 | async 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 | } |