From e34c85e527100c0b5c44567bd951e95be41b8d7e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Nov 2017 10:57:56 +0100 Subject: Fix issues on server start --- server/initializers/constants.ts | 11 +++++++++-- server/initializers/installer.ts | 20 ++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) (limited to 'server/initializers') 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 = { }, VIDEO_CHANNELS: { NAME: { min: 3, max: 120 }, // Length - DESCRIPTION: { min: 3, max: 250 } // Length + DESCRIPTION: { min: 3, max: 250 }, // Length + URL: { min: 3, max: 2000 } // Length }, VIDEOS: { NAME: { min: 3, max: 120 }, // Length @@ -137,7 +138,13 @@ const CONSTRAINTS_FIELDS = { VIEWS: { min: 0 }, LIKES: { min: 0 }, DISLIKES: { min: 0 }, - FILE_SIZE: { min: 10, max: 1024 * 1024 * 1024 * 3 /* 3Go */ } + FILE_SIZE: { min: 10, max: 1024 * 1024 * 1024 * 3 /* 3Go */ }, + URL: { min: 3, max: 2000 } // Length + }, + ACCOUNTS: { + PUBLIC_KEY: { min: 10, max: 5000 }, // Length + PRIVATE_KEY: { min: 10, max: 5000 }, // Length + URL: { min: 3, max: 2000 } // Length }, VIDEO_EVENTS: { 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 @@ import * as passwordGenerator from 'password-generator' import { UserRole } from '../../shared' import { logger, mkdirpPromise, rimrafPromise } from '../helpers' -import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto' import { createUserAccountAndChannel } from '../lib' +import { createLocalAccount } from '../lib/user' import { clientsExist, usersExist } from './checker' import { CACHE, CONFIG, LAST_MIGRATION_VERSION } from './constants' import { database as db } from './database' -import { createLocalAccount } from '../lib/user' async function installApplication () { - await db.sequelize.sync() - await removeCacheDirectories() - await createDirectoriesIfNotExist() - await createOAuthClientIfNotExist() - await createOAuthAdminIfNotExist() - await createApplicationIfNotExist() + try { + await db.sequelize.sync() + await removeCacheDirectories() + await createDirectoriesIfNotExist() + await createOAuthClientIfNotExist() + await createOAuthAdminIfNotExist() + await createApplicationIfNotExist() + } catch (err) { + logger.error('Cannot install application.', err) + throw err + } } // --------------------------------------------------------------------------- -- cgit v1.2.3