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

Conversation

cafuego
Copy link

@cafuego cafuego commented Feb 6, 2020

What does this Pull Request do?

This change allows direct access to Drupal via the virtual machine IP (or hostname) without a change to the Drupal $settings['trusted_host_patterns'] variable.

What's new?

Allows easier access to Islandora on the VM. However, this is not necessarily a safe change for a production installation.

How should this be tested?

Access Islandora via a non-localhost address after VM creation.

Interested parties

Tag (@ mention) interested parties or, if unsure, @Islandora-Devops/committers

This change allows direct access to Drupal via the VM IP (or name) without a change to the Drupal `$settings['trusted_host_patterns']` variable.
@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants