Skip to content

Commit

Permalink
Merge pull request #48 from lkiesow/host-configuration
Browse files Browse the repository at this point in the history
Allow Listening to Specific Hosts
  • Loading branch information
prlanzarin authored Apr 3, 2020
2 parents 6ca6fec + a159db9 commit 6a6425a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion config/custom-environment-variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ redisHost: REDIS_HOST
redisPort: REDIS_PORT
redisPassword: REDIS_PASSWORD

clientHost: CLIENT_HOST

mcs-port: MCS_PORT
mcs-address: MCS_HOST
mcs-host: MCS_HOST
mcs-address: MCS_ADDRESS

freeswitch:
ip: FREESWITCH_CONN_IP
Expand Down
2 changes: 2 additions & 0 deletions config/default.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ redisPort: "6379"
# Uncomment to set a password if Redis requires auth.
# redisPassword: foobared
clientPort: "3008"
clientHost: 127.0.0.1
minVideoPort: 30000
maxVideoPort: 33000
mediaFlowTimeoutDuration: 15000
Expand Down Expand Up @@ -59,6 +60,7 @@ redisExpireTime: 1209600 # 14 days as per the akka keys
# mcs-core entrypoint configured on nginx
mcs-path: /mcs
mcs-port: 3010
mcs-host: 127.0.0.1
mcs-address: localhost
mcs-ws-timeout: 30000
freeswitch:
Expand Down
3 changes: 2 additions & 1 deletion lib/connection-manager/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = class HttpServer {
//const credentials = {key: privateKey, cert: certificate};

this.port = config.get('clientPort');
this.host = config.has('clientHost') ? config.get('clientHost') : '127.0.0.1';

this.server = http.createServer((req,res) => {
}).on('error', this.handleError.bind(this))
Expand All @@ -36,7 +37,7 @@ module.exports = class HttpServer {

listen(callback) {
Logger.info('[HttpServer] Listening in port ' + this.port);
this.server.listen(this.port, callback);
this.server.listen(this.port, this.host, callback);
}

}
3 changes: 2 additions & 1 deletion lib/mcs-core/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class CoreProcess extends BaseProcess {
startMCSServer () {
// HTTPS server
const port = config.get('mcs-port');
const host = config.has('mcs-host') ? config.get('mcs-host') : '127.0.0.1';
const connectionTimeout = config.get('mcs-ws-timeout');
const serverHttps = http.createServer().listen(port, () => {
const serverHttps = http.createServer().listen(port, host, () => {
Logger.info('[app] MCS Server is ready to receive connections');
});

Expand Down

0 comments on commit 6a6425a

Please sign in to comment.