Skip to content
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

Add environment type and fix Config::onProduction #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrewbelcher
Copy link

@andrewbelcher andrewbelcher commented Jan 12, 2022

Fixes #21

@andrewbelcher andrewbelcher changed the title #21 Add environment type and fix Config::onProduction Add environment type and fix Config::onProduction Jan 12, 2022
Copy link

@damz damz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Andrew 👋

Thanks for opening this. This looks like an decent improvement to me, but see the inline comment about a backwards compatibility issue.

$prodBranch = $this->onDedicated() ? 'production' : 'master';

return $this->getValue('BRANCH') == $prodBranch;
return $this->getValue('ENVIRONMENT_TYPE') == 'production';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like some legacy environments will not have that variable, so we need to keep the current logic as backwards compatibility here.

@arnested
Copy link

Friendly ping.

I really wanted to use onProduction() today, but #21 is still an issue.

My best workaround is just doing getenv('PLATFORM_ENVIRONMENT_TYPE') === 'production' instead.

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.

Config::onProduction fails if using branch name "main"
4 participants