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>
This commit is contained in:
parent
c0c7416a23
commit
cff8b272b1
|
@ -1,4 +1,5 @@
|
|||
listen:
|
||||
hostname: '127.0.0.1'
|
||||
port: 9000
|
||||
|
||||
webserver:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
listen:
|
||||
hostname: 'localhost'
|
||||
port: 9000
|
||||
|
||||
# Correspond to your reverse proxy "listen" configuration
|
||||
|
|
|
@ -194,6 +194,7 @@ app.use(function (err, req, res, next) {
|
|||
|
||||
async function startApplication () {
|
||||
const port = CONFIG.LISTEN.PORT
|
||||
const hostname = CONFIG.LISTEN.HOSTNAME
|
||||
|
||||
await installApplication()
|
||||
|
||||
|
@ -214,7 +215,7 @@ async function startApplication () {
|
|||
Redis.Instance.init()
|
||||
|
||||
// Make server listening
|
||||
server.listen(port)
|
||||
logger.info('Server listening on port %d', port)
|
||||
server.listen(port, hostname)
|
||||
logger.info('Server listening on %s:%d', hostname, port)
|
||||
logger.info('Web server: %s', CONFIG.WEBSERVER.URL)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ function checkConfig () {
|
|||
|
||||
// Check the config files
|
||||
function checkMissedConfig () {
|
||||
const required = [ 'listen.port',
|
||||
const required = [ 'listen.port', 'listen.hostname',
|
||||
'webserver.https', 'webserver.hostname', 'webserver.port',
|
||||
'trust_proxy',
|
||||
'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
|
||||
|
|
|
@ -86,7 +86,8 @@ let SCHEDULER_INTERVAL = 60000 * 60
|
|||
const CONFIG = {
|
||||
CUSTOM_FILE: getLocalConfigFilePath(),
|
||||
LISTEN: {
|
||||
PORT: config.get<number>('listen.port')
|
||||
PORT: config.get<number>('listen.port'),
|
||||
HOSTNAME: config.get<string>('listen.hostname')
|
||||
},
|
||||
DATABASE: {
|
||||
DBNAME: 'peertube' + config.get<string>('database.suffix'),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
listen:
|
||||
hostname: '127.0.0.1'
|
||||
port: 9000
|
||||
|
||||
# Correspond to your reverse proxy "listen" configuration
|
||||
|
|
Loading…
Reference in New Issue