# HG changeset patch # User Drew Perttula # Date 1464778515 0 # Node ID cec677a841424a8a10aa1c8ea9ea248b7645dc9a # Parent df2c70f0ecd9ad1caeac4aa91198088a14c60511 homepage serve show root() dir Ignore-this: e48e8b8e7889fd8c63d18cf70c29c260 diff -r df2c70f0ecd9 -r cec677a84142 bin/homepageConfig --- a/bin/homepageConfig Wed Jun 01 07:11:09 2016 +0000 +++ b/bin/homepageConfig Wed Jun 01 10:55:15 2016 +0000 @@ -14,13 +14,7 @@ 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 @@ 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)]}