]> git.ipfire.org Git - ipfire.org.git/commitdiff
web: Change hostname to end in ipfire.org in dev environment
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 3 Nov 2020 12:21:49 +0000 (12:21 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 3 Nov 2020 12:23:21 +0000 (12:23 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/base.py

index 6c5031d80cf021c7b935ca4fd24ff88b22667584..376eff737175cc23c220eed2ff9780069d44ea7d 100644 (file)
@@ -61,8 +61,17 @@ class BaseHandler(tornado.web.RequestHandler):
 
        @property
        def hostname(self):
+               # Return hostname in production
+               if self.request.host.endswith("ipfire.org"):
+                       return self.request.host
+
                # Remove the development prefix
-               return self.request.host.replace(".dev.", ".")
+               subdomain, delimier, domain = self.request.host.partition(".")
+               if subdomain:
+                       return "%s.ipfire.org" % subdomain
+
+               # Return whatever it is
+               return self.request.host
 
        def get_template_namespace(self):
                ns = tornado.web.RequestHandler.get_template_namespace(self)