| Q | A
| ----------------- | ---
| Issue Type | Question
| Deployer Version | 4.0.2
| Local Machine OS | Windows 7
| Remote Machine OS | CentOS 7
Was just wondering if there was a way to check what stage was set when deploying, as I'm using a task that seeds the database, but depending on the stage set, it would have to correctly seed the right data.
Thanks!
stages are available through env and use can use it as below
if (isTesting()) {
set('keep_releases', 1);
} else {
set('keep_releases', 10);
}
function isTesting()
{
$stages = env('stages');
return reset($stages) === 'testing';
}
Notice that you should use get('stages') instead, env() is gone in 4.x.
Thank you! I've got it working.
But why does input()->hasArgument('stage') return true while input()->getArgument('stage') returns NULL ?
Altogether while var_dump(get('stages')); returns an array with one entry containing the stage i'm curently deploying to...
@klefix looks like a bug. Also i think it will be cool get better API for get('stages') (maybe return all stages instead of only one)
Most helpful comment
Notice that you should use
get('stages')instead,env()is gone in 4.x.