Working prosody configuration.
This commit is contained in:
parent
48851d422a
commit
bd91abc5b8
@ -42,7 +42,8 @@ async function ensureWorkingDir (options: RegisterServerOptions): Promise<string
|
|||||||
const logger = options.peertubeHelpers.logger
|
const logger = options.peertubeHelpers.logger
|
||||||
logger.debug('Calling ensureworkingDir')
|
logger.debug('Calling ensureworkingDir')
|
||||||
|
|
||||||
const dir = await getWorkingDir(options)
|
const paths = await getProsodyFilePaths(options)
|
||||||
|
const dir = paths.dir
|
||||||
if (!fs.existsSync(dir)) {
|
if (!fs.existsSync(dir)) {
|
||||||
logger.info(`The working dir ${dir} does not exists, trying to create it`)
|
logger.info(`The working dir ${dir} does not exists, trying to create it`)
|
||||||
await fs.promises.mkdir(dir)
|
await fs.promises.mkdir(dir)
|
||||||
@ -51,6 +52,13 @@ async function ensureWorkingDir (options: RegisterServerOptions): Promise<string
|
|||||||
logger.debug(`Testing write access on ${dir}`)
|
logger.debug(`Testing write access on ${dir}`)
|
||||||
await fs.promises.access(dir, fs.constants.W_OK) // will throw an error if no access
|
await fs.promises.access(dir, fs.constants.W_OK) // will throw an error if no access
|
||||||
logger.debug(`Write access ok on ${dir}`)
|
logger.debug(`Write access ok on ${dir}`)
|
||||||
|
|
||||||
|
if (!fs.existsSync(paths.data)) {
|
||||||
|
logger.info(`The data dir ${paths.data} does not exists, trying to create it`)
|
||||||
|
await fs.promises.mkdir(paths.data)
|
||||||
|
logger.debug(`Working dir ${paths.data} was created`)
|
||||||
|
}
|
||||||
|
|
||||||
return dir
|
return dir
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +68,7 @@ interface ProsodyFilePaths {
|
|||||||
error: string
|
error: string
|
||||||
log: string
|
log: string
|
||||||
config: string
|
config: string
|
||||||
|
data: string
|
||||||
}
|
}
|
||||||
async function getProsodyFilePaths (options: RegisterServerOptions): Promise<ProsodyFilePaths> {
|
async function getProsodyFilePaths (options: RegisterServerOptions): Promise<ProsodyFilePaths> {
|
||||||
const logger = options.peertubeHelpers.logger
|
const logger = options.peertubeHelpers.logger
|
||||||
@ -71,7 +80,8 @@ async function getProsodyFilePaths (options: RegisterServerOptions): Promise<Pro
|
|||||||
pid: path.resolve(dir, 'prosody.pid'),
|
pid: path.resolve(dir, 'prosody.pid'),
|
||||||
error: path.resolve(dir, 'prosody.err'),
|
error: path.resolve(dir, 'prosody.err'),
|
||||||
log: path.resolve(dir, 'prosody.log'),
|
log: path.resolve(dir, 'prosody.log'),
|
||||||
config: path.resolve(dir, 'prosody.cfg.lua')
|
config: path.resolve(dir, 'prosody.cfg.lua'),
|
||||||
|
data: path.resolve(dir, 'data')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,27 +95,30 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise<Prosod
|
|||||||
logger.debug('Calling getProsodyConfig')
|
logger.debug('Calling getProsodyConfig')
|
||||||
|
|
||||||
const port = '5280'
|
const port = '5280'
|
||||||
|
const peertubePort = '9000' // FIXME
|
||||||
const peertubeDomain = 'localhost'
|
const peertubeDomain = 'localhost'
|
||||||
const paths = await getProsodyFilePaths(options)
|
const paths = await getProsodyFilePaths(options)
|
||||||
const logMode: LogMode = 'debug'
|
const logMode: LogMode = 'debug' // FIXME: remove debug mode, and use info
|
||||||
const content = `
|
const content = `
|
||||||
|
|
||||||
admins = { }
|
admins = { }
|
||||||
plugin_paths = { }
|
plugin_paths = { }
|
||||||
|
data_path = "${paths.data}"
|
||||||
|
|
||||||
modules_enabled = {
|
modules_enabled = {
|
||||||
|
"roster"; -- Allow users to have a roster. Recommended ;)
|
||||||
|
"saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
|
||||||
"version"; -- Replies to server version requests
|
"version"; -- Replies to server version requests
|
||||||
"uptime"; -- Report how long server has been running
|
"uptime"; -- Report how long server has been running
|
||||||
"ping"; -- Replies to XMPP pings with pongs
|
"ping"; -- Replies to XMPP pings with pongs
|
||||||
|
|
||||||
"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
|
"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
|
||||||
-- "websocket"; -- XMPP over WebSockets
|
|
||||||
|
|
||||||
"posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
|
"posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
|
||||||
}
|
}
|
||||||
modules_disabled = {
|
modules_disabled = {
|
||||||
"offline"; -- Store offline messages
|
-- "offline"; -- Store offline messages
|
||||||
"c2s"; -- Handle client connections
|
-- "c2s"; -- Handle client connections
|
||||||
"s2s"; -- Handle server-to-server connections
|
"s2s"; -- Handle server-to-server connections
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +146,7 @@ cross_domain_websocket = false;
|
|||||||
consider_websocket_secure = true;
|
consider_websocket_secure = true;
|
||||||
https_ports = {};
|
https_ports = {};
|
||||||
|
|
||||||
VirtualHost "anon.localhost"
|
VirtualHost "localhost"
|
||||||
trusted_proxies = { "127.0.0.1", "::1" }
|
trusted_proxies = { "127.0.0.1", "::1" }
|
||||||
|
|
||||||
authentication = "anonymous"
|
authentication = "anonymous"
|
||||||
@ -144,7 +157,9 @@ VirtualHost "anon.localhost"
|
|||||||
"ping";
|
"ping";
|
||||||
}
|
}
|
||||||
http_host = "${peertubeDomain}"
|
http_host = "${peertubeDomain}"
|
||||||
http_external_url = "http://${peertubeDomain}"
|
http_external_url = "http://${
|
||||||
|
peertubePort ? peertubeDomain + ':' + peertubePort : peertubeDomain
|
||||||
|
}"
|
||||||
|
|
||||||
Component "room.localhost" "muc"
|
Component "room.localhost" "muc"
|
||||||
restrict_room_creation = "local"
|
restrict_room_creation = "local"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user