+ // Moved configuration keys
+ if (config.has('services.csp-logger')) {
+ logger.warn('services.csp-logger configuration has been renamed to csp.report_uri. Please update your configuration file.')
+ }
+
+ checkEmailConfig()
+ checkNSFWPolicyConfig()
+ checkLocalRedundancyConfig()
+ checkRemoteRedundancyConfig()
+ checkStorageConfig()
+ checkTranscodingConfig()
+ checkBroadcastMessageConfig()
+ checkSearchConfig()
+ checkLiveConfig()
+ checkObjectStorageConfig()
+ checkVideoEditorConfig()
+}
+
+// We get db by param to not import it in this file (import orders)
+async function clientsExist () {
+ const totalClients = await OAuthClientModel.countTotal()
+
+ return totalClients !== 0
+}
+
+// We get db by param to not import it in this file (import orders)
+async function usersExist () {
+ const totalUsers = await UserModel.countTotal()
+
+ return totalUsers !== 0
+}
+
+// We get db by param to not import it in this file (import orders)
+async function applicationExist () {
+ const totalApplication = await ApplicationModel.countTotal()
+
+ return totalApplication !== 0
+}
+
+async function checkFFmpegVersion () {
+ const version = await getFFmpegVersion()
+ const { major, minor } = parseSemVersion(version)
+
+ if (major < 4 || (major === 4 && minor < 1)) {
+ logger.warn('Your ffmpeg version (%s) is outdated. PeerTube supports ffmpeg >= 4.1. Please upgrade.', version)
+ }
+}
+
+// ---------------------------------------------------------------------------
+
+export {
+ checkConfig,
+ clientsExist,
+ checkFFmpegVersion,
+ usersExist,
+ applicationExist,
+ checkActivityPubUrls
+}
+
+// ---------------------------------------------------------------------------
+
+function checkEmailConfig () {
+ if (!isEmailEnabled()) {
+ if (CONFIG.SIGNUP.ENABLED && CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) {
+ throw new Error('Emailer is disabled but you require signup email verification.')
+ }
+
+ if (CONFIG.CONTACT_FORM.ENABLED) {
+ logger.warn('Emailer is disabled so the contact form will not work.')