Skip to content

Commit

Permalink
fix for missing hostnames setting (fix #41)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed May 13, 2024
1 parent a60834a commit 982fedb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/ansibleguy-webui/aw/config/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from aw.config.hardcoded import ENV_KEY_CONFIG, ENV_KEY_SAML

AW_ENV_VARS = {
'hostnames': ['AW_HOSTNAMES'],
'port': ['AW_PORT'],
'proxy': ['AW_PROXY'],
'address': ['AW_LISTEN', 'AW_LISTEN_ADDRESS'],
'timezone': ['AW_TIMEZONE'],
'secret': ['AW_SECRET'],
Expand Down
4 changes: 3 additions & 1 deletion src/ansibleguy-webui/aw/config/form_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
# env-vars
'timezone': 'Timezone',
'db': 'Database',
'hostnames': 'Hostnames',
'proxy': 'Using Proxy',
'db_migrate': 'Database auto-upgrade',
'serve_static': 'Serving static files',
'deployment': 'Deployment',
Expand Down Expand Up @@ -224,7 +226,7 @@
'mail_ssl_verify': 'En- or disable SSL certificate verification. '
'If enabled - the certificate SAN has to contain the mail-server FQDN '
'and must be issued from a trusted CA',
'mail_sender': 'Mail Sender Address to use for Alert Mails',
'mail_sender': 'Mail Sender Address to use for Alert Mails. Fallback is mail-user',
'mail_transport': 'The default port mapping is: 25 = Unencrypted, 465 = SSL, 587 = StartTLS',
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/ansibleguy-webui/aw/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


from aw.config.hardcoded import LOGIN_PATH, ENV_KEY_CONFIG, ENV_KEY_SAML
from aw.config.defaults import CONFIG_DEFAULTS
from aw.config.defaults import CONFIG_DEFAULTS, inside_docker
from aw.utils.deployment import deployment_dev, deployment_prod
from aw.config.environment import get_aw_env_var_or_default, auth_mode_saml
from aw.utils.debug import log
Expand Down Expand Up @@ -157,7 +157,8 @@ def get_main_web_address() -> str:
return f'http://localhost:{PORT_WEB}'

_hostname = environ['AW_HOSTNAMES'].split(',', 1)[0]
if 'AW_PROXY' in environ: # we will not know what port the proxy is serving this service.. assume its 443
if 'AW_PROXY' in environ or inside_docker():
# we will not know what port the proxy is serving this service - assume its 443
return f'https://{_hostname}'

return f'https://{_hostname}:{PORT_WEB}'
Expand Down

0 comments on commit 982fedb

Please sign in to comment.