New debug mode:
Debug mode is no more triggered by the NODE_ENV value, but by testing the existance of a file in the plugin data directory.
This commit is contained in:
committed by
John Livingston
parent
f8b83defb5
commit
b4dabfeeb9
19
server/lib/debug.ts
Normal file
19
server/lib/debug.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
|
||||
export function isDebugMode (options: RegisterServerOptions): boolean {
|
||||
const peertubeHelpers = options.peertubeHelpers
|
||||
const logger = peertubeHelpers.logger
|
||||
|
||||
if (!peertubeHelpers.plugin) {
|
||||
return false
|
||||
}
|
||||
const filepath = path.resolve(peertubeHelpers.plugin.getDataDirectoryPath(), 'debug_mode')
|
||||
logger.debug('Testing debug mode by testing if file exists: ' + filepath)
|
||||
if (fs.existsSync(filepath)) {
|
||||
logger.info('Plugin livechat Debug mode is on.')
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user