Simplify compile_url
This commit is contained in:
parent
76220d811d
commit
410958a2a7
@ -15,8 +15,7 @@ from cryptography.x509.oid import NameOID
|
|||||||
|
|
||||||
def compile_url(domain, port, proto='https'):
|
def compile_url(domain, port, proto='https'):
|
||||||
port = '' if (proto == 'https' and port == '443') or (proto == 'http' and port == '80') else ':{}'.format(port)
|
port = '' if (proto == 'https' and port == '443') or (proto == 'http' and port == '80') else ':{}'.format(port)
|
||||||
host = '{}{}'.format(domain, port)
|
return '{}://{}{}'.format(proto, domain, port)
|
||||||
return '{}://{}'.format(proto, host) if proto is not None else host
|
|
||||||
|
|
||||||
def get_local_ipv4():
|
def get_local_ipv4():
|
||||||
# Return first routable IPv4 address of the VM (container host)
|
# Return first routable IPv4 address of the VM (container host)
|
||||||
|
@ -131,7 +131,7 @@ class WSGIApp(object):
|
|||||||
self.conf.save()
|
self.conf.save()
|
||||||
# Redirect to host setup view
|
# Redirect to host setup view
|
||||||
return redirect('/setup-host')
|
return redirect('/setup-host')
|
||||||
host = tools.compile_url(self.conf['host']['domain'], self.conf['host']['port'], None)
|
host = tools.compile_url(self.conf['host']['domain'], self.conf['host']['port'])[8:]
|
||||||
if request.session['admin']:
|
if request.session['admin']:
|
||||||
return self.render_template('portal-admin.html', request, host=host)
|
return self.render_template('portal-admin.html', request, host=host)
|
||||||
return self.render_template('portal-user.html', request, host=host)
|
return self.render_template('portal-user.html', request, host=host)
|
||||||
|
Loading…
Reference in New Issue
Block a user