Prosody: new settings to provide a custom certificates dir

This commit is contained in:
John Livingston
2023-04-13 18:22:03 +02:00
committed by John Livingston
parent a87a622cba
commit 801798852c
12 changed files with 205 additions and 71 deletions

View File

@ -12,7 +12,8 @@ async function _ensureWorkingDir (
options: RegisterServerOptions,
workingDir: string,
dataDir: string,
certsDir: string,
certsDir: string | undefined,
certsDirIsCustom: boolean,
appImageExtractPath: string
): Promise<string> {
const logger = options.peertubeHelpers.logger
@ -33,7 +34,7 @@ async function _ensureWorkingDir (
logger.debug(`data dir ${dataDir} was created`)
}
if (!fs.existsSync(certsDir)) {
if (certsDir && !certsDirIsCustom && !fs.existsSync(certsDir)) {
// Certificates dir for Prosody.
// Note: not used yet, but we create the directory to avoid errors in prosody logs.
logger.info(`The certs dir ${certsDir} does not exists, trying to create it`)
@ -61,7 +62,14 @@ async function prepareProsody (options: RegisterServerOptions): Promise<void> {
const filePaths = await getProsodyFilePaths(options)
logger.debug('Ensuring that the working dir exists')
await _ensureWorkingDir(options, filePaths.dir, filePaths.data, filePaths.certs, filePaths.appImageExtractPath)
await _ensureWorkingDir(
options,
filePaths.dir,
filePaths.data,
filePaths.certs,
filePaths.certsDirIsCustom,
filePaths.appImageExtractPath
)
const appImageToExtract = filePaths.appImageToExtract
if (!appImageToExtract) {