Support environments() on scheduled task definition #49
Unanswered
joekeilty-oub
asked this question in
Ideas
Replies: 1 comment 3 replies
-
This would be nice :), using the same workaround now. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there, first of all thanks for your package it is very helpful.
I have a feature request to support the environments option when defining a scheduled task.
With the setup:
.env
Kernel.php
When running
schedule-monitor:sync
andschedule-monitor:list
on the staging environment, I'd expect only to monitor one command (normalcommand
) especially if using OhDear integration, but it actually adds both of the commands even though we've constrained the second one to the production environment. This can lead to developer confusion, unexpected behaviour and potentially false positives on OhDear alertsA workaround for this is to not use environments option and wrap the scheduled task definitions in
if (App::environment() === 'production')
etc. checks, but I find using->environments()
is a lot cleaner and saves duplication of code.The
Event
class has arunsInEnvironment()
method which could support this behaviourBeta Was this translation helpful? Give feedback.
All reactions