aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/installer.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-14 17:31:26 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (patch)
treef4191f3c04a5230fcf8ca3d6ca3248643fc4151d /server/initializers/installer.ts
parente34c85e527100c0b5c44567bd951e95be41b8d7e (diff)
downloadPeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.gz
PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.zst
PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.zip
Follow works
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}