Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Dynamic drupal trusted hosts setting. #158

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions inventory/vagrant/group_vars/webserver/drupal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ drupal_enable_modules:
drupal_trusted_hosts:
- ^localhost$
- "{{ hostvars[groups['webserver'][0]].ansible_host }}"
- "^' . preg_quote($_SERVER['SERVER_NAME']) . '$"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a PHP command...does that work within the ansible framework which is (I think) Ruby?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it works because settings.php is a php file? I haven't tried it yet to find out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhhhhhh 🤦‍♂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, running ansible with this entry added to the variables will add '^' . preg_quote($_SERVER['SERVER_NAME']) . '$' to the trusted host patterns. That means any name (or IP) you use to access the Islandora instance in the VM will automagically be trusted, so you don't need to explicitly add it.

drupal_trusted_hosts_file: "{{ drupal_core_path }}/sites/default/settings.php"
drupal_public_filesystem: "{{ drupal_core_path }}/sites/default/files"
drupal_external_libraries_directory: "{{ drupal_core_path }}/libraries"
Expand Down