platformsh / config-reader-python

Configuration reader library for Platform.sh hosting - Python version.
MIT License
7 stars 5 forks source link

Update the process used by on_production() to determine whether or not the current branch is production #39

Open hannesvz opened 1 year ago

hannesvz commented 1 year ago

In L421 of config.py the prod_branch variable is set based on whether or not the environment is called master.

Since Platform.sh now allows for renaming the default / production branch, this no longer produces an accurate value because it can be called anything (defaulting to main).

A more accurate way of determining whether or not the current branch is a production branch is to query the PLATFORM_ENVIRONMENT_TYPE environmental variable, which will return the correct environment type regardless of its name.