-
Notifications
You must be signed in to change notification settings - Fork 397
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
[looking for] The recommended way to use a custom Environment Detector in a non-acquia production environment. #4437
Comments
here's an example of how to extend it to use in a non-acquia environment: https://github.com/mikemadison13/blt-gitlab-pipelines/blob/main/src/Blt/Plugin/EnvironmentDetector/GitlabDetector.php#L7 In this case, I'm adding a detection for Gitlab (which is non-Acquia). |
Though there is something amiss with the environment detector.
(I added some debugging code above).
which then evaluates to true. So there is really no way for a custom environment detector to say that it is "not" local. I have been meaning to report this as a bug. |
@mikemadison13 With your example, I still think the EnvironmentDetector would return true for isLocalEnv(). @shelane that's exactly it! **So there is really no way for a custom environment detector to say that it is "not" local. ** |
…e false is returned.
Add a new function that custom environment detectors can have return true when a non-local environment is detected.
In the meantime, this patch completely disables the OOTB environment detection. Not suggesting this gets committed. Only a temporary workaround to force handoff to custom environment detectors. |
I want to...
I want to use BLT with a custom environment detector when hosting in non-acquia environments. Some of our clients are hosted on acquia, and others are not, but we like to use BLT for consistency in tooling. After BLT 11, the documented method seems to no longer work as expeted.
https://docs.acquia.com/blt/extending-blt/#overriding-the-environment-detector
It's not working because...
Environment Detector will incorrectly return true. What we will see, is in production environments config splits for local and prod are active.
After digging into it, it looks like it is related to: vendor/acquia/blt/src/Robo/Common/EnvironmentDetector.php
which calls
parent::isLocalEnv()
, which will return true if it does not have the AH_ENV.I have made a workaround by patching blt, however I don't think this is the right approach.
The text was updated successfully, but these errors were encountered: