Skip to content

Add support for Platform.sh #4

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

AaronFeledy
Copy link

Resolves #2

Platform.sh allows a user to create their own environments with arbitrary names. It also allows a user to define the type of environment that it is (development, staging, production). The names and types are available in environment variables. I opted to have getEnvironment() always return the user-defined environment name and introduce a new getEnvironmentType() method to the PlatformSh class to be used by isProduction() and the like to get the type of environment.

Neither Lando nor DDEV supply the environment type variable, so I defaulted to "local" when it is not present.

@AaronFeledy AaronFeledy requested a review from davereid as a code owner July 1, 2023 22:44
@AaronFeledy AaronFeledy force-pushed the platformsh branch 2 times, most recently from b833432 to b793418 Compare July 1, 2023 23:01
@AaronFeledy
Copy link
Author

@davereid The code climate action won't be able to complete successfully because CC_TEST_REPORTER_ID will be empty since secrets aren't available to PRs coming from a forked repo.

@AaronFeledy AaronFeledy mentioned this pull request Apr 19, 2024
@davereid
Copy link
Owner

davereid commented Mar 27, 2025

I made some changes to the workflow and also test coverage to help support overwriting other non-environment global variables, so this looks like it's passing. I'll give this some more review shortly!

@davereid
Copy link
Owner

davereid commented Mar 27, 2025

I would say we probably want the reverse, for getEnvironment() to return the type (development, test, live) and add a new getEnvironmentName() or getName() to return the user-defined environment name. We would want the settings-file-inclusion workflow to work consistently across hosting platforms to always include a settings.live.php or settings.test.php file.

…add getEnvironmentName() method

Update based on PR feedback to separate environment type and name, ensuring consistent behavior across platforms.

- Renamed getEnvironmentType() to getEnvironment() in PlatformSh for consistency
- Added getEnvironmentName() method to return user-defined environment name
- Updated tests to reflect the new API design
@AaronFeledy
Copy link
Author

AaronFeledy commented Mar 30, 2025

I've updated the PR based on the feedback provided:

  1. Refactored the implementation to separate environment type and name:

    • now returns the environment type (development, staging, production)
    • Added to return the user-defined environment name
    • Updated all related is* methods to check against the environment type
  2. Updated the test cases to verify the new behavior

@davereid Please let me know if you'd like any additional changes.

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.

Support Platform.sh
2 participants