From 614073ef7d0d3934668a06bb75fbba90ed8152d8 Mon Sep 17 00:00:00 2001 From: Valeryi Savich Date: Mon, 26 Mar 2018 17:35:56 +0300 Subject: [PATCH] Added optional argument for the start_link/0 function --- lib/worker.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/worker.ex b/lib/worker.ex index 4d29578..c8b87d5 100644 --- a/lib/worker.ex +++ b/lib/worker.ex @@ -27,7 +27,7 @@ defmodule Spotter.Worker do end def start_link() do - GenServer.start_link(__MODULE__, %{config: config()}) + GenServer.start_link(__MODULE__, %{config: config(), opts: []}) end def start_link(opts) do @@ -44,7 +44,8 @@ defmodule Spotter.Worker do @connection.configure_channel(@channel_name, opts[:config]) channel = get_channel() - {:ok, [channel: channel, meta: configure(channel, opts[:opts])]} + {:ok, custom} = configure(channel, opts[:opts]) + {:ok, [channel: channel, meta: custom]} end end