Hi there
I’m building an app that uses Oban, and specifically the Cron Plugin. Now I’ve got a couple of jobs that are executed periodically (like sending some mails, checking for stuff etc), and I wanted to change the config so that those jobs are not run by cron in dev
.
So basically the idea was, instead of this in config.exs
:
config :my_app, Oban,
repo: ....
plugins: [
Oban.Plugin.Gossip,
....
{Oban.Plugin.Cron, crontab: [some_cron_jobs_here]}
]
I’d simply not put the Cron
plugin in the config.exs
file, but instead add it only in the prod.exs
file, like this:
config.exs
:
config :my_app, Oban,
repo: ....
plugins: [
Oban.Plugin.Gossip,
....
]
and in prod.exs
add the cron jobs:
config :my_app, Oban,
plugins: [
{Oban.Plugin.Cron, crontab: [some_cron_jobs_here]}
]
But that overrides the base config from config.exs
and removes all the plugins configured there already.
Is there a way to split the config like this? I’m already aware that I can simply use if config_env() == :prod do
in the config.exs
file (that’s my solution now), but that’s just not so nice…
Thanks