refactor: simplify how url generation works

The URLS file is no longer necessary as urls are now generated directly from the app VHOST file.

This also moves all the url generation logic to the domains plugin.
This commit is contained in:
Jose Diaz-Gonzalez
2022-12-02 02:19:59 -05:00
parent f4f0a29446
commit edd6e476b3
23 changed files with 247 additions and 179 deletions

View File

@@ -311,7 +311,6 @@ nginx_build_config() {
declare desc="build nginx config to proxy app containers using sigil"
declare APP="$1" DOKKU_APP_LISTEN_PORT="$2" DOKKU_APP_LISTEN_IP="$3"
local VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
local APP_URLS_PATH="$DOKKU_ROOT/$APP/URLS"
local NGINX_TEMPLATE_NAME="nginx.conf.sigil"
local NGINX_TEMPLATE="$PLUGIN_AVAILABLE_PATH/nginx-vhosts/templates/$NGINX_TEMPLATE_NAME"
local SCHEME=http
@@ -329,7 +328,7 @@ nginx_build_config() {
plugn trigger domains-vhost-enabled "$APP" 2>/dev/null || IS_APP_VHOST_ENABLED=false
local IS_SSL_ENABLED=false
if is_ssl_enabled "$APP"; then
if [[ "$(plugn trigger certs-exists "$APP")" == "true" ]]; then
IS_SSL_ENABLED=true
fi
@@ -516,11 +515,6 @@ nginx_build_config() {
dokku_log_verbose "Reloading nginx"
validate_nginx && restart_nginx >/dev/null
fi
if ([[ -n "$NONSSL_VHOSTS" ]] || [[ -n "$SSL_VHOSTS" ]]) && [[ "$IS_APP_VHOST_ENABLED" == "true" ]]; then
echo "# THIS FILE IS GENERATED BY DOKKU - DO NOT EDIT, YOUR CHANGES WILL BE OVERWRITTEN" >"$APP_URLS_PATH"
xargs -i echo "$SCHEME://{}" <<<"$(echo "${SSL_VHOSTS}" "${NONSSL_VHOSTS}" | tr ' ' '\n' | sort -u)" >>"$APP_URLS_PATH"
fi
else
# note because this clause is long. if the proxy is disabled:
dokku_log_info1 "Nginx support is disabled for app ($APP)"