Skip to content

Commit

Permalink
Added flag to allow unique gateways per host and port
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Mar 14, 2021
1 parent 276a96c commit cc7dbc0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions etc/schemas/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"spec": {
"type": "object",
"properties": {
"ex_uniqueGatewayPerHostPort": {
"type": "boolean"
},
"registrarIntf": {
"enum": ["Internal", "External", "internal", "external"]
},
Expand Down
1 change: 1 addition & 0 deletions mod/core/config/config_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = upSince => {
userAgent: `Routr ${version}`
},
spec: {
ex_uniqueGatewayPerHostPort: false,
bindAddr: InetAddress.getLocalHost().getHostAddress(),
localnets: [],
transport: [
Expand Down
5 changes: 4 additions & 1 deletion mod/data_api/gateways_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
const DSUtils = require('@routr/data_api/utils')
const APIBase = require('@routr/data_api/api_base')
const config = require('@routr/core/config_util')()
const { Status } = require('@routr/core/status')
const { buildAddr } = require('@routr/utils/misc_utils')
const { FOUND_DEPENDENT_OBJECTS_RESPONSE } = require('@routr/core/status')
Expand Down Expand Up @@ -77,7 +78,9 @@ class GatewaysAPI extends APIBase {
}

gatewayExist (host, port) {
return DSUtils.objExist(this.getGatewayByHostAndPort(host, port))
return config.spec.ex_uniqueGatewayPerHostPort
? DSUtils.objExist(this.getGatewayByHostAndPort(host, port))
: false
}

deleteGateway (ref) {
Expand Down

0 comments on commit cc7dbc0

Please sign in to comment.