diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-14 10:57:56 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | e34c85e527100c0b5c44567bd951e95be41b8d7e (patch) | |
tree | 39697c5a4dda2c2e07142a8522538db783fce2fd /server/initializers | |
parent | 1e1265b36c09df1465aa2b4866815c957b6a532e (diff) | |
download | PeerTube-e34c85e527100c0b5c44567bd951e95be41b8d7e.tar.gz PeerTube-e34c85e527100c0b5c44567bd951e95be41b8d7e.tar.zst PeerTube-e34c85e527100c0b5c44567bd951e95be41b8d7e.zip |
Fix issues on server start
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.ts | 11 | ||||
-rw-r--r-- | server/initializers/installer.ts | 20 |
2 files changed, 21 insertions, 10 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 5d0d39395..e27d011fa 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -121,7 +121,8 @@ const CONSTRAINTS_FIELDS = { | |||
121 | }, | 121 | }, |
122 | VIDEO_CHANNELS: { | 122 | VIDEO_CHANNELS: { |
123 | NAME: { min: 3, max: 120 }, // Length | 123 | NAME: { min: 3, max: 120 }, // Length |
124 | DESCRIPTION: { min: 3, max: 250 } // Length | 124 | DESCRIPTION: { min: 3, max: 250 }, // Length |
125 | URL: { min: 3, max: 2000 } // Length | ||
125 | }, | 126 | }, |
126 | VIDEOS: { | 127 | VIDEOS: { |
127 | NAME: { min: 3, max: 120 }, // Length | 128 | NAME: { min: 3, max: 120 }, // Length |
@@ -137,7 +138,13 @@ const CONSTRAINTS_FIELDS = { | |||
137 | VIEWS: { min: 0 }, | 138 | VIEWS: { min: 0 }, |
138 | LIKES: { min: 0 }, | 139 | LIKES: { min: 0 }, |
139 | DISLIKES: { min: 0 }, | 140 | DISLIKES: { min: 0 }, |
140 | FILE_SIZE: { min: 10, max: 1024 * 1024 * 1024 * 3 /* 3Go */ } | 141 | FILE_SIZE: { min: 10, max: 1024 * 1024 * 1024 * 3 /* 3Go */ }, |
142 | URL: { min: 3, max: 2000 } // Length | ||
143 | }, | ||
144 | ACCOUNTS: { | ||
145 | PUBLIC_KEY: { min: 10, max: 5000 }, // Length | ||
146 | PRIVATE_KEY: { min: 10, max: 5000 }, // Length | ||
147 | URL: { min: 3, max: 2000 } // Length | ||
141 | }, | 148 | }, |
142 | VIDEO_EVENTS: { | 149 | VIDEO_EVENTS: { |
143 | COUNT: { min: 0 } | 150 | COUNT: { min: 0 } |
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index c617b16c9..5221b81a5 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -1,21 +1,25 @@ | |||
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 { logger, mkdirpPromise, rimrafPromise } from '../helpers' | 3 | import { logger, mkdirpPromise, rimrafPromise } from '../helpers' |
4 | import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto' | ||
5 | import { createUserAccountAndChannel } from '../lib' | 4 | import { createUserAccountAndChannel } from '../lib' |
5 | import { createLocalAccount } from '../lib/user' | ||
6 | import { clientsExist, usersExist } from './checker' | 6 | import { clientsExist, usersExist } from './checker' |
7 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' | 7 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' |
8 | 8 | ||
9 | import { database as db } from './database' | 9 | import { database as db } from './database' |
10 | import { createLocalAccount } from '../lib/user' | ||
11 | 10 | ||
12 | async function installApplication () { | 11 | async function installApplication () { |
13 | await db.sequelize.sync() | 12 | try { |
14 | await removeCacheDirectories() | 13 | await db.sequelize.sync() |
15 | await createDirectoriesIfNotExist() | 14 | await removeCacheDirectories() |
16 | await createOAuthClientIfNotExist() | 15 | await createDirectoriesIfNotExist() |
17 | await createOAuthAdminIfNotExist() | 16 | await createOAuthClientIfNotExist() |
18 | await createApplicationIfNotExist() | 17 | await createOAuthAdminIfNotExist() |
18 | await createApplicationIfNotExist() | ||
19 | } catch (err) { | ||
20 | logger.error('Cannot install application.', err) | ||
21 | throw err | ||
22 | } | ||
19 | } | 23 | } |
20 | 24 | ||
21 | // --------------------------------------------------------------------------- | 25 | // --------------------------------------------------------------------------- |