diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-14 17:38:41 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-19 10:53:16 +0100 |
commit | 50d6de9c286abcb34ff4234d56d9cbb803db7665 (patch) | |
tree | f1732b27edcd05c7877a8358b8312f1e38c287ed /server/initializers/installer.ts | |
parent | fadf619ad61a016c1c7fc53de5a8f398a4f77519 (diff) | |
download | PeerTube-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.ts | 17 |
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 @@ | |||
1 | import * as passwordGenerator from 'password-generator' | 1 | import * as passwordGenerator from 'password-generator' |
2 | import { UserRole } from '../../shared' | 2 | import { UserRole } from '../../shared' |
3 | import { createPrivateAndPublicKeys, logger, mkdirpPromise, rimrafPromise } from '../helpers' | 3 | import { logger, mkdirpPromise, rimrafPromise } from '../helpers' |
4 | import { createLocalAccountWithoutKeys, createUserAccountAndChannel } from '../lib' | 4 | import { createApplicationActor, createUserAccountAndChannel } from '../lib/user' |
5 | import { UserModel } from '../models/account/user' | 5 | import { UserModel } from '../models/account/user' |
6 | import { ApplicationModel } from '../models/application/application' | 6 | import { ApplicationModel } from '../models/application/application' |
7 | import { OAuthClientModel } from '../models/oauth/oauth-client' | 7 | import { OAuthClientModel } from '../models/oauth/oauth-client' |
8 | import { applicationExist, clientsExist, usersExist } from './checker' | 8 | import { applicationExist, clientsExist, usersExist } from './checker' |
9 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants' | 9 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' |
10 | import { sequelizeTypescript } from './database' | 10 | import { sequelizeTypescript } from './database' |
11 | 11 | ||
12 | async function installApplication () { | 12 | async 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 | } |