mirror of https://github.com/Chocobozzz/PeerTube
Support hostname binding in config
* Add basic support for hostname binding Signed-off-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com> * Make production example a bit more secure Signed-off-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com> * Make example config files compatible with hostname binding modification Signed-off-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com> * Fix typo Signed-off-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com> * Bind on 127.0.0.1 by default Signed-off-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com> * Update Docker configuration with hostname binding Signed-off-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com>pull/525/head
parent
c0c7416a23
commit
cff8b272b1
|
@ -1,4 +1,5 @@
|
||||||
listen:
|
listen:
|
||||||
|
hostname: '127.0.0.1'
|
||||||
port: 9000
|
port: 9000
|
||||||
|
|
||||||
webserver:
|
webserver:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
listen:
|
listen:
|
||||||
|
hostname: 'localhost'
|
||||||
port: 9000
|
port: 9000
|
||||||
|
|
||||||
# Correspond to your reverse proxy "listen" configuration
|
# Correspond to your reverse proxy "listen" configuration
|
||||||
|
|
|
@ -194,6 +194,7 @@ app.use(function (err, req, res, next) {
|
||||||
|
|
||||||
async function startApplication () {
|
async function startApplication () {
|
||||||
const port = CONFIG.LISTEN.PORT
|
const port = CONFIG.LISTEN.PORT
|
||||||
|
const hostname = CONFIG.LISTEN.HOSTNAME
|
||||||
|
|
||||||
await installApplication()
|
await installApplication()
|
||||||
|
|
||||||
|
@ -214,7 +215,7 @@ async function startApplication () {
|
||||||
Redis.Instance.init()
|
Redis.Instance.init()
|
||||||
|
|
||||||
// Make server listening
|
// Make server listening
|
||||||
server.listen(port)
|
server.listen(port, hostname)
|
||||||
logger.info('Server listening on port %d', port)
|
logger.info('Server listening on %s:%d', hostname, port)
|
||||||
logger.info('Web server: %s', CONFIG.WEBSERVER.URL)
|
logger.info('Web server: %s', CONFIG.WEBSERVER.URL)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ function checkConfig () {
|
||||||
|
|
||||||
// Check the config files
|
// Check the config files
|
||||||
function checkMissedConfig () {
|
function checkMissedConfig () {
|
||||||
const required = [ 'listen.port',
|
const required = [ 'listen.port', 'listen.hostname',
|
||||||
'webserver.https', 'webserver.hostname', 'webserver.port',
|
'webserver.https', 'webserver.hostname', 'webserver.port',
|
||||||
'trust_proxy',
|
'trust_proxy',
|
||||||
'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
|
'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
|
||||||
|
|
|
@ -86,7 +86,8 @@ let SCHEDULER_INTERVAL = 60000 * 60
|
||||||
const CONFIG = {
|
const CONFIG = {
|
||||||
CUSTOM_FILE: getLocalConfigFilePath(),
|
CUSTOM_FILE: getLocalConfigFilePath(),
|
||||||
LISTEN: {
|
LISTEN: {
|
||||||
PORT: config.get<number>('listen.port')
|
PORT: config.get<number>('listen.port'),
|
||||||
|
HOSTNAME: config.get<string>('listen.hostname')
|
||||||
},
|
},
|
||||||
DATABASE: {
|
DATABASE: {
|
||||||
DBNAME: 'peertube' + config.get<string>('database.suffix'),
|
DBNAME: 'peertube' + config.get<string>('database.suffix'),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
listen:
|
listen:
|
||||||
|
hostname: '127.0.0.1'
|
||||||
port: 9000
|
port: 9000
|
||||||
|
|
||||||
# Correspond to your reverse proxy "listen" configuration
|
# Correspond to your reverse proxy "listen" configuration
|
||||||
|
|
Loading…
Reference in New Issue