diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.ts | 6 | ||||
-rw-r--r-- | server/initializers/database.ts | 5 | ||||
-rw-r--r-- | server/initializers/installer.ts | 24 | ||||
-rw-r--r-- | server/initializers/migrations/0075-video-resolutions.ts | 1 |
4 files changed, 15 insertions, 21 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index e6fda88c2..2d61094bd 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -361,12 +361,6 @@ export { | |||
361 | PODS_SCORE, | 361 | PODS_SCORE, |
362 | PREVIEWS_SIZE, | 362 | PREVIEWS_SIZE, |
363 | REMOTE_SCHEME, | 363 | REMOTE_SCHEME, |
364 | REQUEST_ENDPOINT_ACTIONS, | ||
365 | REQUEST_ENDPOINTS, | ||
366 | REQUEST_VIDEO_EVENT_ENDPOINT, | ||
367 | REQUEST_VIDEO_EVENT_TYPES, | ||
368 | REQUEST_VIDEO_QADU_ENDPOINT, | ||
369 | REQUEST_VIDEO_QADU_TYPES, | ||
370 | REQUESTS_IN_PARALLEL, | 364 | REQUESTS_IN_PARALLEL, |
371 | REQUESTS_INTERVAL, | 365 | REQUESTS_INTERVAL, |
372 | REQUESTS_LIMIT_PER_POD, | 366 | REQUESTS_LIMIT_PER_POD, |
diff --git a/server/initializers/database.ts b/server/initializers/database.ts index aefb6da3a..1383bb33b 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts | |||
@@ -2,7 +2,6 @@ import { join } from 'path' | |||
2 | import { flattenDepth } from 'lodash' | 2 | import { flattenDepth } from 'lodash' |
3 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string | 3 | require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string |
4 | import * as Sequelize from 'sequelize' | 4 | import * as Sequelize from 'sequelize' |
5 | import * as Bluebird from 'bluebird' | ||
6 | 5 | ||
7 | import { CONFIG } from './constants' | 6 | import { CONFIG } from './constants' |
8 | // Do not use barrel, we need to load database first | 7 | // Do not use barrel, we need to load database first |
@@ -19,10 +18,6 @@ import { UserModel } from '../models/account/user-interface' | |||
19 | import { AccountVideoRateModel } from '../models/account/account-video-rate-interface' | 18 | import { AccountVideoRateModel } from '../models/account/account-video-rate-interface' |
20 | import { AccountFollowModel } from '../models/account/account-follow-interface' | 19 | import { AccountFollowModel } from '../models/account/account-follow-interface' |
21 | import { TagModel } from './../models/video/tag-interface' | 20 | import { TagModel } from './../models/video/tag-interface' |
22 | import { RequestModel } from './../models/request/request-interface' | ||
23 | import { RequestVideoQaduModel } from './../models/request/request-video-qadu-interface' | ||
24 | import { RequestVideoEventModel } from './../models/request/request-video-event-interface' | ||
25 | import { RequestToPodModel } from './../models/request/request-to-pod-interface' | ||
26 | import { PodModel } from './../models/pod/pod-interface' | 21 | import { PodModel } from './../models/pod/pod-interface' |
27 | import { OAuthTokenModel } from './../models/oauth/oauth-token-interface' | 22 | import { OAuthTokenModel } from './../models/oauth/oauth-token-interface' |
28 | import { OAuthClientModel } from './../models/oauth/oauth-client-interface' | 23 | import { OAuthClientModel } from './../models/oauth/oauth-client-interface' |
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 | } |
diff --git a/server/initializers/migrations/0075-video-resolutions.ts b/server/initializers/migrations/0075-video-resolutions.ts index e1d9fdacb..e7d8a2876 100644 --- a/server/initializers/migrations/0075-video-resolutions.ts +++ b/server/initializers/migrations/0075-video-resolutions.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import * as Promise from 'bluebird' | ||
3 | import { join } from 'path' | 2 | import { join } from 'path' |
4 | 3 | ||
5 | import { readdirPromise, renamePromise } from '../../helpers/core-utils' | 4 | import { readdirPromise, renamePromise } from '../../helpers/core-utils' |