dockersetup: handle http/https port properly

* Use the port number in the domain so that emails have working URLs
* Don't include the port in the URL printed at the end of installation
  if it's the default

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2019-06-26 14:33:14 +12:00
parent d215e2899a
commit a8bb9e64bb

View File

@ -708,10 +708,23 @@ if return_code != 0:
print("Collecting static files failed")
sys.exit(1)
if https_port and not no_https:
protocol = 'https'
port = https_port
defport == '443'
else:
protocol = 'http'
port = http_port
defport = '80'
if port == defport:
host = hostname
else:
host = '%s:%s' % (hostname, port)
if not updatemode:
if not dbfile:
## Set site name
return_code = subprocess.call(['docker-compose', 'run', '--rm', 'layersapp', '/opt/layerindex/layerindex/tools/site_name.py', hostname, 'OpenEmbedded Layer Index'], shell=False)
return_code = subprocess.call(['docker-compose', 'run', '--rm', 'layersapp', '/opt/layerindex/layerindex/tools/site_name.py', host, 'OpenEmbedded Layer Index'], shell=False)
if not no_admin_user:
## For a fresh database, create an admin account
@ -729,11 +742,5 @@ else:
print("")
print("NOTE: you may need to use -p %s (or set COMPOSE_PROJECT_NAME=\"%s\" ) if running docker-compose directly in future" % (project_name, project_name))
print("")
if https_port and not no_https:
protocol = 'https'
port = https_port
else:
protocol = 'http'
port = http_port
print("The application should now be accessible at %s://%s:%s" % (protocol, hostname, port))
print("The application should now be accessible at %s://%s" % (protocol, host))
print("")