mirror of https://github.com/Chocobozzz/PeerTube
Add warning if one of the storage directory is in the peertube
production directory Because admins could loose these directories on peertube upgradepull/1103/head
parent
a893681058
commit
00f9e41ebf
|
@ -64,6 +64,10 @@ function isTestInstance () {
|
||||||
return process.env.NODE_ENV === 'test'
|
return process.env.NODE_ENV === 'test'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isProdInstance () {
|
||||||
|
return process.env.NODE_ENV === 'production'
|
||||||
|
}
|
||||||
|
|
||||||
function root () {
|
function root () {
|
||||||
// We are in /helpers/utils.js
|
// We are in /helpers/utils.js
|
||||||
const paths = [ __dirname, '..', '..' ]
|
const paths = [ __dirname, '..', '..' ]
|
||||||
|
@ -179,6 +183,8 @@ const createTorrentPromise = promisify2<string, any, any>(createTorrent)
|
||||||
|
|
||||||
export {
|
export {
|
||||||
isTestInstance,
|
isTestInstance,
|
||||||
|
isProdInstance,
|
||||||
|
|
||||||
root,
|
root,
|
||||||
escapeHTML,
|
escapeHTML,
|
||||||
pageToStartAndCount,
|
pageToStartAndCount,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as config from 'config'
|
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 { UserModel } from '../models/account/user'
|
||||||
import { ApplicationModel } from '../models/application/application'
|
import { ApplicationModel } from '../models/application/application'
|
||||||
import { OAuthClientModel } from '../models/oauth/oauth-client'
|
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
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue