diff options
author | Magnus Ahltorp <map@kth.se> | 2016-06-10 15:12:46 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2016-06-10 15:12:46 +0200 |
commit | d5f7e595959229f7e4dee42adc518e14d05fed48 (patch) | |
tree | cde242dac02b6a5ed238303a7ce921bbfe81c7b2 /tools/compileconfig.py | |
parent | bbf254d6d7f1708503f425c0eb8926af1b715b9c (diff) |
Implement CATLFISH-74
Diffstat (limited to 'tools/compileconfig.py')
-rwxr-xr-x | tools/compileconfig.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tools/compileconfig.py b/tools/compileconfig.py index 25518ee..777a12f 100755 --- a/tools/compileconfig.py +++ b/tools/compileconfig.py @@ -88,7 +88,7 @@ def get_address(bind_address, nodeconfig): host = "0.0.0.0" return (host, port) -def gen_http_servers(nodetype, nodeconfig, bind_address, bind_publicaddress, bind_publichttpaddress): +def gen_http_servers(nodetype, nodeconfig, bind_addresses, bind_publicaddress, bind_publichttpaddress): http_servers = [] https_servers = [] @@ -97,7 +97,7 @@ def gen_http_servers(nodetype, nodeconfig, bind_address, bind_publicaddress, bin sys.exit(1) if "frontendnodes" in nodetype: - (host, port) = get_address(bind_address, nodeconfig["frontendnodes"]) + (host, port) = get_address(bind_addresses["frontend"], nodeconfig["frontendnodes"]) if bind_publicaddress: (publichost, publicport) = parse_address(bind_publicaddress) else: @@ -110,13 +110,13 @@ def gen_http_servers(nodetype, nodeconfig, bind_address, bind_publicaddress, bin https_servers.append((Symbol("external_https_api"), publichost, publicport, Symbol("v1"))) https_servers.append((Symbol("frontend_https_api"), host, port, Symbol("frontend"))) if "storagenodes" in nodetype: - (host, port) = get_address(bind_address, nodeconfig["storagenodes"]) + (host, port) = get_address(bind_addresses["storage"], nodeconfig["storagenodes"]) https_servers.append((Symbol("storage_https_api"), host, port, Symbol("storage"))) if "signingnodes" in nodetype: - (host, port) = get_address(bind_address, nodeconfig["signingnodes"]) + (host, port) = get_address(bind_addresses["signing"], nodeconfig["signingnodes"]) https_servers.append((Symbol("signing_https_api"), host, port, Symbol("signing"))) if "mergenodes" in nodetype: - (host, port) = get_address(bind_address, nodeconfig["mergenodes"]) + (host, port) = get_address(bind_addresses["merge"], nodeconfig["mergenodes"]) https_servers.append((Symbol("frontend_https_api"), host, port, Symbol("frontend"))) if nodetype - set(["frontendnodes", "storagenodes", "signingnodes", "mergenodes"]): print >>sys.stderr, "unknown nodetype", nodetype @@ -196,8 +196,13 @@ def parse_ratelimit((type, description)): 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) + bind_addresses = { + "frontend": localconfig.get("frontendaddresses", {}).get(nodename), + "storage": localconfig.get("storageaddresses", {}).get(nodename), + "signing": localconfig.get("signingaddresses", {}).get(nodename), + "merge": localconfig.get("mergeaddresses", {}).get(nodename), + } + bind_publicaddress = localconfig.get("ctapiaddresses", {}).get(nodename) bind_publichttpaddress = localconfig.get("publichttpaddresses", {}).get(nodename) options = localconfig.get("options", []) @@ -205,7 +210,7 @@ def gen_config(nodename, config, localconfig): print >>configfile, "%% catlfish configuration file (-*- erlang -*-)" (nodetype, nodeconfig) = get_node_config(nodename, config) - (http_servers, https_servers) = gen_http_servers(nodetype, nodeconfig, bind_address, bind_publicaddress, bind_publichttpaddress=bind_publichttpaddress) + (http_servers, https_servers) = gen_http_servers(nodetype, nodeconfig, bind_addresses, bind_publicaddress, bind_publichttpaddress=bind_publichttpaddress) catlfishconfig = [] plopconfig = [] |