diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-10 17:27:49 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (patch) | |
tree | e57173bcd0590d939c28952a29258fd02a281e35 /server/initializers/installer.ts | |
parent | 38fa2065831b5f55be0d7f30f19a62c967397208 (diff) | |
download | PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.gz PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.tar.zst PeerTube-571389d43b8fc8aaf27e77c06f19b320b08dbbc9.zip |
Make it compile at least
Diffstat (limited to 'server/initializers/installer.ts')
-rw-r--r-- | server/initializers/installer.ts | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index c8f6b3bc2..c617b16c9 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -1,20 +1,21 @@ | |||
1 | import * as passwordGenerator from 'password-generator' | 1 | import * as passwordGenerator from 'password-generator' |
2 | import * as Bluebird from 'bluebird' | 2 | import { UserRole } from '../../shared' |
3 | import { logger, mkdirpPromise, rimrafPromise } from '../helpers' | ||
4 | import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto' | ||
5 | import { createUserAccountAndChannel } from '../lib' | ||
6 | import { clientsExist, usersExist } from './checker' | ||
7 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' | ||
3 | 8 | ||
4 | import { database as db } from './database' | 9 | import { database as db } from './database' |
5 | import { CONFIG, LAST_MIGRATION_VERSION, CACHE } from './constants' | 10 | import { createLocalAccount } from '../lib/user' |
6 | import { clientsExist, usersExist } from './checker' | ||
7 | import { logger, createCertsIfNotExist, mkdirpPromise, rimrafPromise } from '../helpers' | ||
8 | import { createUserAccountAndChannel } from '../lib' | ||
9 | import { UserRole } from '../../shared' | ||
10 | 11 | ||
11 | async function installApplication () { | 12 | async function installApplication () { |
12 | await db.sequelize.sync() | 13 | await db.sequelize.sync() |
13 | await removeCacheDirectories() | 14 | await removeCacheDirectories() |
14 | await createDirectoriesIfNotExist() | 15 | await createDirectoriesIfNotExist() |
15 | await createCertsIfNotExist() | ||
16 | await createOAuthClientIfNotExist() | 16 | await createOAuthClientIfNotExist() |
17 | await createOAuthAdminIfNotExist() | 17 | await createOAuthAdminIfNotExist() |
18 | await createApplicationIfNotExist() | ||
18 | } | 19 | } |
19 | 20 | ||
20 | // --------------------------------------------------------------------------- | 21 | // --------------------------------------------------------------------------- |
@@ -28,7 +29,7 @@ export { | |||
28 | function removeCacheDirectories () { | 29 | function removeCacheDirectories () { |
29 | const cacheDirectories = CACHE.DIRECTORIES | 30 | const cacheDirectories = CACHE.DIRECTORIES |
30 | 31 | ||
31 | const tasks: Bluebird<any>[] = [] | 32 | const tasks: Promise<any>[] = [] |
32 | 33 | ||
33 | // Cache directories | 34 | // Cache directories |
34 | for (const key of Object.keys(cacheDirectories)) { | 35 | for (const key of Object.keys(cacheDirectories)) { |
@@ -120,7 +121,12 @@ async function createOAuthAdminIfNotExist () { | |||
120 | await createUserAccountAndChannel(user, validatePassword) | 121 | await createUserAccountAndChannel(user, validatePassword) |
121 | logger.info('Username: ' + username) | 122 | logger.info('Username: ' + username) |
122 | logger.info('User password: ' + password) | 123 | logger.info('User password: ' + password) |
124 | } | ||
123 | 125 | ||
126 | async function createApplicationIfNotExist () { | ||
124 | logger.info('Creating Application table.') | 127 | logger.info('Creating Application table.') |
125 | await db.Application.create({ migrationVersion: LAST_MIGRATION_VERSION }) | 128 | const applicationInstance = await db.Application.create({ migrationVersion: LAST_MIGRATION_VERSION }) |
129 | |||
130 | logger.info('Creating application account.') | ||
131 | return createLocalAccount('peertube', null, applicationInstance.id, undefined) | ||
126 | } | 132 | } |