pantheon-systems / pantheon_domain_masking

Domain Masking helper module for D8
GNU General Public License v2.0
11 stars 6 forks source link

allow_platform should only affect the live environment #30

Open adamfranco opened 1 year ago

adamfranco commented 1 year ago

I want to disable platform access for only my live environment while still allowing users to access the dev-<site>.pantheonsite.io/ and test-<site>.pantheonsite.io/ instances for validation and testing.

I was able to work around this by overriding the stored config setting in settings.php if the environment wasn't live, but this feels like it should work out of the box:

/**
 * Only honor domain masking in live environment.
 *
 * Don't force domain masking in lando, dev, or test. We can ship yes or no
 * in config to allow/disallow domain masking on a per-site basis, but don't
 * get locked out of the platform in other environments.
 */
if ($_ENV['PANTHEON_ENVIRONMENT'] != 'live') {
  $config['pantheon_domain_masking.settings']['allow_platform'] = 'yes';
}

I guess a similar technique could just enable/disable domain masking in the other environments instead of toggling allow_platform. I don't have a sense as to why one would be preferable to the other though.