summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2016-06-10 15:12:46 +0200
committerLinus Nordberg <linus@nordu.net>2016-07-11 14:53:53 +0200
commit1a36628401658def9ab9595f7cbcf72b8cb4eb6a (patch)
tree2ca049fc2af135594c578c67f4ba39e564e96fdb /tools
parent3004bb8a1a839640ff6d4ff591abf8ddc1df2b7c (diff)
Implement CATLFISH-74
Diffstat (limited to 'tools')
-rwxr-xr-xtools/compileconfig.py21
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 = []