-
-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #622 from roots/hosts
Require explicit redirects and drop www_redirect
- Loading branch information
Showing
15 changed files
with
72 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
wordpress_env_defaults: | ||
db_host: localhost | ||
db_name: "{{ item.key | underscore }}_{{ env }}" | ||
db_user: "{{ item.key | underscore }}" | ||
disable_wp_cron: true | ||
wp_env: "{{ env }}" | ||
wp_home: "{{ item.value.ssl.enabled | default(false) | ternary('https', 'http') }}://${HTTP_HOST}" | ||
wp_siteurl: "${WP_HOME}/wp" | ||
|
||
site_env: "{{ wordpress_env_defaults | combine(item.value.env | default({}), vault_wordpress_sites[item.key].env) }}" | ||
site_hosts_canonical: "{{ item.value.site_hosts | map(attribute='canonical') | list }}" | ||
site_hosts_redirects: "{{ item.value.site_hosts | selectattr('redirects', 'defined') | sum(attribute='redirects', start=[]) | list }}" | ||
site_hosts: "{{ site_hosts_canonical | union(site_hosts_redirects) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ | |
wordpress_sites: | ||
example.com: | ||
site_hosts: | ||
- example.dev | ||
- canonical: example.dev | ||
redirects: | ||
- www.example.dev | ||
local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root) | ||
admin_email: [email protected] | ||
multisite: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ | |
wordpress_sites: | ||
example.com: | ||
site_hosts: | ||
- example.com | ||
- canonical: example.com | ||
redirects: | ||
- www.example.com | ||
local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root) | ||
repo: [email protected]:example/example.com.git # replace with your Git repo URL | ||
repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ | |
wordpress_sites: | ||
example.com: | ||
site_hosts: | ||
- staging.example.com | ||
- canonical: staging.example.com | ||
# redirects: | ||
# - otherdomain.com | ||
local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root) | ||
repo: [email protected]:example/example.com.git # replace with your Git repo URL | ||
repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Required format for `site_hosts` (group_vars/{{ env }}/wordpress_sites.yml): | ||
|
||
example.com: | ||
site_hosts: | ||
- canonical: example.com | ||
|
||
The above is the minimum required. Multiple hosts and redirects are possible: | ||
|
||
example.com: | ||
site_hosts: | ||
- canonical: example.com | ||
redirects: | ||
- www.example.com | ||
- site.com | ||
- canonical: example.co.uk | ||
redirects: | ||
- www.example.co.uk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
server { | ||
listen 80; | ||
server_name {{ item.item.value.site_hosts | reverse_www(enabled=item.item.value.www_redirect | default(true)) | join(' ') }}; | ||
server_name{% for item in item.item.value.site_hosts %} {{ item.canonical }}{% for redirect in item.redirects | default([]) %} {{ redirect }}{% endfor %}{% endfor %}; | ||
include acme-challenge-location.conf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters