diff bin/homepageConfig @ 1312:cec677a84142

homepage serve show root() dir Ignore-this: e48e8b8e7889fd8c63d18cf70c29c260
author Drew Perttula <drewp@bigasterisk.com>
date Wed, 01 Jun 2016 10:55:15 +0000
parents 3aee96f3295e
children 44558087d3f6
line wrap: on
line diff
--- 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)]}