aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/installer.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-14 17:38:41 +0100
committerChocobozzz <me@florianbigard.com>2017-12-19 10:53:16 +0100
commit50d6de9c286abcb34ff4234d56d9cbb803db7665 (patch)
treef1732b27edcd05c7877a8358b8312f1e38c287ed /server/initializers/installer.ts
parentfadf619ad61a016c1c7fc53de5a8f398a4f77519 (diff)
downloadPeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.gz
PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.zst
PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.zip
Begin moving video channel to actor
Diffstat (limited to 'server/initializers/installer.ts')
-rw-r--r--server/initializers/installer.ts17
1 files changed, 7 insertions, 10 deletions
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts
index 5452743b6..ee3c9dfd9 100644
--- a/server/initializers/installer.ts
+++ b/server/initializers/installer.ts
@@ -1,12 +1,12 @@
1import * as passwordGenerator from 'password-generator' 1import * as passwordGenerator from 'password-generator'
2import { UserRole } from '../../shared' 2import { UserRole } from '../../shared'
3import { createPrivateAndPublicKeys, logger, mkdirpPromise, rimrafPromise } from '../helpers' 3import { logger, mkdirpPromise, rimrafPromise } from '../helpers'
4import { createLocalAccountWithoutKeys, createUserAccountAndChannel } from '../lib' 4import { createApplicationActor, createUserAccountAndChannel } from '../lib/user'
5import { UserModel } from '../models/account/user' 5import { UserModel } from '../models/account/user'
6import { ApplicationModel } from '../models/application/application' 6import { ApplicationModel } from '../models/application/application'
7import { OAuthClientModel } from '../models/oauth/oauth-client' 7import { OAuthClientModel } from '../models/oauth/oauth-client'
8import { applicationExist, clientsExist, usersExist } from './checker' 8import { applicationExist, clientsExist, usersExist } from './checker'
9import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants' 9import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants'
10import { sequelizeTypescript } from './database' 10import { sequelizeTypescript } from './database'
11 11
12async function installApplication () { 12async function installApplication () {
@@ -134,15 +134,12 @@ async function createApplicationIfNotExist () {
134 if (exist === true) return undefined 134 if (exist === true) return undefined
135 135
136 logger.info('Creating Application table.') 136 logger.info('Creating Application table.')
137 const applicationInstance = await ApplicationModel.create({ migrationVersion: LAST_MIGRATION_VERSION })
138 137
139 logger.info('Creating application account.') 138 logger.info('Creating application account.')
140 139
141 const accountCreated = await createLocalAccountWithoutKeys(SERVER_ACCOUNT_NAME, null, applicationInstance.id, undefined) 140 const application = await ApplicationModel.create({
142 141 migrationVersion: LAST_MIGRATION_VERSION
143 const { publicKey, privateKey } = await createPrivateAndPublicKeys() 142 })
144 accountCreated.set('publicKey', publicKey)
145 accountCreated.set('privateKey', privateKey)
146 143
147 return accountCreated.save() 144 return createApplicationActor(application.id)
148} 145}