Commit 1cc80f11 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Replace SCHEME & SITE_DOMAIN with SITE_URL & HOME_URL

parent 2e938fe3
Loading
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -90,6 +90,15 @@ database.

The hostname of the MySQL server providing the database.

### HOME_URL

**Type**: string\
**Required**: no\
**Default**: [**SITE_URL**](#SITE_URL) with path components removed

The URL where visitors should first be directed to when accessing the web site. It defaults 
to the root path of [**SITE_URL**](#SITE_URL).

### LANGUAGES

**Type**: array\
@@ -138,6 +147,17 @@ An array of "key=value" strings declaring [PHP directives][].
> arguments preceded by the '-d' flag:
> `-d upload_max_filesize=20M -d post_max_size=20M`

### SITE_URL

**Type**: string\
**Required**: yes\
**Example**: "https://my.example.org/blog"

The base URL where the Wordpress app is hosted externally.  This MUST include at least 
a protocol scheme (e.g. "https://") and a host name; it MAY contain a port, when external 
access is via a non-standard port; if MAY contain a path component, when the Wordpress app 
is not accessed at the root path.

### STATIC_PATTERNS

**Type**: array\
+8 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ declare -r DEFAULT_THEME=twentynineteen
declare -r WORKER_USER=www-data

declare DB_HOST DB_NAME DB_USER DB_PASS
declare HOME_URL SITE_URL
declare -a THEMES=( ${THEMES-} )
declare -a PLUGINS=( ${PLUGINS-} )
declare -a LANGUAGES=( ${LANGUAGES-} )
@@ -63,15 +64,19 @@ create_config()
		${DB_HOST+--dbhost="${DB_HOST}"} \
		${DB_PASS+--dbpass="${DB_PASS}"}

	wp config set WP_SITEURL "${SCHEME:=https}://${SITE_DOMAIN? Please set SITE_DOMAIN in /etc/wordpress/}"
	wp config set WP_HOME "${SCHEME}://$SITE_DOMAIN"
	local site_url=${SITE_URL? Please set SITE_URL}
	local site_path=${site_url#*://*/}
	local home_url=${HOME_URL:-${site_url%$site_path}}

	wp config set WP_SITEURL "${site_url%/}"
	wp config set WP_HOME "${home_url%/}"
}

setup_database() {
	wp core is-installed && return

	wp core install \
		--url=${SCHEME}://$SITE_DOMAIN \
		--url="${SITE_URL%/}" \
		--title="${SITE_TITLE:-New Wordpress Site}" \
		--admin_user="${SITE_ADMIN:-admin}" \
		--admin_email="${SITE_ADMIN_EMAIL:-admin@$SITE_DOMAIN}" \