From 00f9e41ebfaed4867e971bfb8042e3359eb67eda Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Sep 2018 16:16:07 +0200 Subject: Add warning if one of the storage directory is in the peertube production directory Because admins could loose these directories on peertube upgrade --- server/initializers/checker.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'server/initializers') diff --git a/server/initializers/checker.ts b/server/initializers/checker.ts index a54f6155b..5b068caa1 100644 --- a/server/initializers/checker.ts +++ b/server/initializers/checker.ts @@ -1,5 +1,5 @@ import * as config from 'config' -import { promisify0 } from '../helpers/core-utils' +import { promisify0, isProdInstance } from '../helpers/core-utils' import { UserModel } from '../models/account/user' import { ApplicationModel } from '../models/application/application' import { OAuthClientModel } from '../models/oauth/oauth-client' @@ -59,6 +59,18 @@ function checkConfig () { } } + if (isProdInstance()) { + const configStorage = config.get('storage') + for (const key of Object.keys(configStorage)) { + if (configStorage[key].startsWith('storage/')) { + logger.warn( + 'Directory of %s should not be in the production directory of PeerTube. Please check your production configuration file.', + key + ) + } + } + } + return null } -- cgit v1.2.3