Skip to content

Add support for Platform.sh - #4

Open
AaronFeledy wants to merge 6 commits into
davereid:mainfrom
AaronFeledy:platformsh
Open

Add support for Platform.sh#4
AaronFeledy wants to merge 6 commits into
davereid:mainfrom
AaronFeledy:platformsh

Conversation

@AaronFeledy

Copy link
Copy Markdown

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
Copy Markdown
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

davereid commented Mar 27, 2025

Copy link
Copy Markdown
Owner

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

davereid commented Mar 27, 2025

Copy link
Copy Markdown
Owner

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

AaronFeledy commented Mar 30, 2025

Copy link
Copy Markdown
Author

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