aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/installer.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-10 17:27:49 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (patch)
treee57173bcd0590d939c28952a29258fd02a281e35 /server/initializers/installer.ts
parent38fa2065831b5f55be0d7f30f19a62c967397208 (diff)
downloadPeerTube-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.ts24
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 @@
1import * as passwordGenerator from 'password-generator' 1import * as passwordGenerator from 'password-generator'
2import * as Bluebird from 'bluebird' 2import { UserRole } from '../../shared'
3import { logger, mkdirpPromise, rimrafPromise } from '../helpers'
4import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto'
5import { createUserAccountAndChannel } from '../lib'
6import { clientsExist, usersExist } from './checker'
7import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants'
3 8
4import { database as db } from './database' 9import { database as db } from './database'
5import { CONFIG, LAST_MIGRATION_VERSION, CACHE } from './constants' 10import { createLocalAccount } from '../lib/user'
6import { clientsExist, usersExist } from './checker'
7import { logger, createCertsIfNotExist, mkdirpPromise, rimrafPromise } from '../helpers'
8import { createUserAccountAndChannel } from '../lib'
9import { UserRole } from '../../shared'
10 11
11async function installApplication () { 12async 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 {
28function removeCacheDirectories () { 29function 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
126async 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}