summaryrefslogtreecommitdiff
path: root/tools/compileconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/compileconfig.py')
-rwxr-xr-xtools/compileconfig.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/compileconfig.py b/tools/compileconfig.py
index 52f10e8..88d6b51 100755
--- a/tools/compileconfig.py
+++ b/tools/compileconfig.py
@@ -77,17 +77,24 @@ def get_node_config(nodename, config):
sys.exit(1)
return (nodetype, nodeconfig)
-def gen_https_servers(nodetype, nodeconfig):
+def gen_https_servers(nodetype, nodeconfig, bind_address, bind_publicaddress):
+ if bind_address:
+ (host, port) = parse_address(bind_address)
+ else:
+ (_, port) = parse_address(nodeconfig["address"])
+ host = "0.0.0.0"
if nodetype == "frontendnodes":
- (publichost, publicport) = parse_address(nodeconfig["publicaddress"])
- (host, port) = parse_address(nodeconfig["address"])
+ if bind_publicaddress:
+ (publichost, publicport) = parse_address(bind_publicaddress)
+ else:
+ (_, publicport) = parse_address(nodeconfig["publicaddress"])
+ publichost = "0.0.0.0"
+
return [(Symbol("external_https_api"), publichost, publicport, Symbol("v1")),
(Symbol("frontend_https_api"), host, port, Symbol("frontend"))]
elif nodetype == "storagenodes":
- (host, port) = parse_address(nodeconfig["address"])
return [(Symbol("storage_https_api"), host, port, Symbol("storage"))]
elif nodetype == "signingnodes":
- (host, port) = parse_address(nodeconfig["address"])
return [(Symbol("signing_https_api"), host, port, Symbol("signing"))]
def allowed_clients_frontend(mergenodenames):
@@ -136,13 +143,15 @@ def allowed_servers_frontend(signingnodenames, storagenodenames):
def gen_config(nodename, config, localconfig):
print "generating config for", nodename
paths = localconfig["paths"]
+ bind_address = localconfig.get("addresses", {}).get(nodename)
+ bind_publicaddress = localconfig.get("publicaddresses", {}).get(nodename)
options = localconfig.get("options", [])
configfile = open(paths["configdir"] + nodename + ".config", "w")
print >>configfile, "%% catlfish configuration file (-*- erlang -*-)"
(nodetype, nodeconfig) = get_node_config(nodename, config)
- https_servers = gen_https_servers(nodetype, nodeconfig)
+ https_servers = gen_https_servers(nodetype, nodeconfig, bind_address, bind_publicaddress)
catlfishconfig = []
plopconfig = []