# HG changeset patch # User Drew Perttula # Date 2016-06-01 10:55:15 # Node ID cec677a841424a8a10aa1c8ea9ea248b7645dc9a # Parent df2c70f0ecd9ad1caeac4aa91198088a14c60511 homepage serve show root() dir Ignore-this: e48e8b8e7889fd8c63d18cf70c29c260 diff --git a/bin/homepageConfig b/bin/homepageConfig --- a/bin/homepageConfig +++ b/bin/homepageConfig @@ -14,13 +14,7 @@ graph = showconfig.getGraph() netHome = graph.value(showconfig.showUri(), L9['networking']) print "listen %s;" % splitport(urlparse(graph.value(netHome, L9['webServer'])).netloc)[1] -for role, server in sorted(graph.predicate_objects(netHome)): - if not server.startswith('http') or role == L9['webServer']: - continue - path = graph.value(role, L9['urlPath']) - if not path: - continue - server = server.rstrip('/') +def location(path, server): print """ location /%(path)s { @@ -33,3 +27,21 @@ for role, server in sorted(graph.predica proxy_pass %(server)s; rewrite /[^/]+/(.*) /$1 break; }""" % vars() + +for role, server in sorted(graph.predicate_objects(netHome)): + if not server.startswith('http') or role == L9['webServer']: + continue + path = graph.value(role, L9['urlPath']) + if not path: + continue + server = server.rstrip('/') + location(path, server) + + + +showPath = showconfig.showUri().split('/', 3)[-1] +print """ + location /%(path)s { + root %(root)s; + }""" % {'path': showPath, + 'root': showconfig.root()[:-len(showPath)]}