Closed coop closed 5 years ago
I also realised that confex's :system
adapter expects "VERK_DISABLED"
to be set otherwise an error is raised (this error isn't reported when starting up an app). I ended up implementing a custom adapter that handles the env var not being present:
config :verk,
queues: {{:via, MyApp.Verk.Env}, {:queues, "VERK_DISABLED"}},
max_retry_count: 10,
poll_interval: 5000,
start_job_log_level: :info,
done_job_log_level: :info,
fail_job_log_level: :info,
node_id: "1",
redis_url: "redis://127.0.0.1:6379"
defmodule MyApp.Verk.Env do
def queues("true"), do: {:ok, []}
def queues(_) do
{:ok, [default: 25, other_queue: 1]}
end
def fetch_value({fun, key}) do
value = System.get_env(key)
apply(__MODULE__, fun, [value])
end
end
This way my web processes (include dev) don't have to set an env var to get the "default" behaviour.
@coop, thank you for the PR! I will release a new minor version soon 👍
Would you mind updating the README with the custom adapter you showed here? Thanks again!
The documentation suggests that you do the following:
Unfortunately this MFA style configuration was only introduced in confex 3.3. I have bumped the version of confex to
~> 3.3.0
so the documentation is correct. Is that any reason we can't bump to~> 3.3
?