Port configuration.

This commit is contained in:
John Livingston 2021-04-16 15:13:46 +02:00
parent fce0e7c63c
commit 295a55c9f6
2 changed files with 28 additions and 7 deletions

View File

@ -94,15 +94,30 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise<Prosod
const logger = options.peertubeHelpers.logger const logger = options.peertubeHelpers.logger
logger.debug('Calling getProsodyConfig') logger.debug('Calling getProsodyConfig')
const port = '5280' const port = (await options.settingsManager.getSetting('prosody-port') as string) || '52800'
if (!/^\d+$/.test(port)) {
throw new Error('Invalid port')
}
const peertubeDomain = 'localhost' const peertubeDomain = 'localhost'
const paths = await getProsodyFilePaths(options) const paths = await getProsodyFilePaths(options)
const logMode: LogMode = 'info' const logMode: LogMode = 'info'
const content = ` const content = `
admins = { } daemonize = false
pidfile = "${paths.pid}"
plugin_paths = { } plugin_paths = { }
data_path = "${paths.data}" data_path = "${paths.data}"
interfaces = { "127.0.0.1" }
c2s_ports = { }
c2s_interfaces = { "127.0.0.1" }
s2s_ports = { }
s2s_interfaces = { "127.0.0.1" }
http_ports = { "${port}" }
http_interfaces = { "127.0.0.1" }
https_ports = { }
https_interfaces = { "127.0.0.1" }
admins = { }
modules_enabled = { modules_enabled = {
"roster"; -- Allow users to have a roster. Recommended ;) "roster"; -- Allow users to have a roster. Recommended ;)
@ -123,10 +138,6 @@ modules_disabled = {
allow_registration = false allow_registration = false
daemonize = false
pidfile = "${paths.pid}"
c2s_require_encryption = false c2s_require_encryption = false
archive_expires_after = "1w" -- Remove archived messages after 1 week archive_expires_after = "1w" -- Remove archived messages after 1 week
@ -143,7 +154,6 @@ cross_domain_bosh = false
consider_bosh_secure = true consider_bosh_secure = true
cross_domain_websocket = false cross_domain_websocket = false
consider_websocket_secure = true consider_websocket_secure = true
https_ports = { }
VirtualHost "localhost" VirtualHost "localhost"
trusted_proxies = { "127.0.0.1", "::1" } trusted_proxies = { "127.0.0.1", "::1" }

View File

@ -81,6 +81,17 @@ export function initSettings (options: RegisterServerOptions): void {
descriptionHTML: 'If checked, this will use a builtin XMPP server. This is the recommanded setup.' descriptionHTML: 'If checked, this will use a builtin XMPP server. This is the recommanded setup.'
}) })
registerSetting({
name: 'prosody-port',
label: 'Builtin prosody: Prosody port',
type: 'input',
default: '52800',
private: true,
descriptionHTML: 'The port that will be used by the builtin Prosody server.<br>' +
'Change it if this port is already in use on your server.<br>' +
'You can close this port on your firewall, it will not be accessed from the outer world.'
})
registerSetting({ registerSetting({
name: 'chat-use-builtin', name: 'chat-use-builtin',
label: 'Use builtin ConverseJS', label: 'Use builtin ConverseJS',