From 350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Nov 2017 17:31:26 +0100 Subject: Follow works --- server/initializers/installer.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'server/initializers/installer.ts') 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' import { logger, mkdirpPromise, rimrafPromise } from '../helpers' import { createUserAccountAndChannel } from '../lib' import { createLocalAccount } from '../lib/user' -import { clientsExist, usersExist } from './checker' -import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' +import { applicationExist, clientsExist, usersExist } from './checker' +import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants' import { database as db } from './database' @@ -128,9 +128,13 @@ async function createOAuthAdminIfNotExist () { } async function createApplicationIfNotExist () { + const exist = await applicationExist(db.Application) + // Nothing to do, application already exist + if (exist === true) return undefined + logger.info('Creating Application table.') const applicationInstance = await db.Application.create({ migrationVersion: LAST_MIGRATION_VERSION }) logger.info('Creating application account.') - return createLocalAccount('peertube', null, applicationInstance.id, undefined) + return createLocalAccount(SERVER_ACCOUNT_NAME, null, applicationInstance.id, undefined) } -- cgit v1.2.3