 
 check_interval_ms = process.env.HUBOT_TRELLO_INTERVAL ? 1000 * 60 * 5
 checker = undefined
-trello_key = process.env.HUBOT_TRELLO_KEY
-trello_token = process.env.HUBOT_TRELLO_TOKEN
-trello_board_id = process.env.HUBOT_TRELLO_BOARD_ID
-trello_notify_room = process.env.HUBOT_TRELLO_NOTIFY_ROOM
-
-last_notif_id = undefined
-
+config =
+  key: process.env.HUBOT_TRELLO_KEY
+  token: process.env.HUBOT_TRELLO_TOKEN
+  board_id: process.env.HUBOT_TRELLO_BOARD_ID
+  notify_room: process.env.HUBOT_TRELLO_NOTIFY_ROOM
 filter_actions =
   changeCard: (notif) ->
     if 'listAfter' not of notif.data

    "#{notif.memberCreator.username} commented on card `#{notif.data.card.name}`: #{notif.data.text} - #{cardUrl(notif.data.card)}"
  createdCard: (notif) ->
    "#{notif.memberCreator.username} created card `#{notif.data.card.name}` - #{cardUrl(notif.data.card)}"

cardUrl = (card) ->
  "https://trello.com/card/#{trello_board_id}/#{card.idShort}"

connect = (onConnected, onError) ->
  console.error "missing HUBOT_TRELLO_KEY" if not trello_key
  console.error "missing HUBOT_TRELLO_TOKEN" if not trello_token
  console.error "missing HUBOT_TRELLO_BOARD_ID" if not trello_board_id
  console.error "missing HUBOT_TRELLO_NOTIFY_ROOM" if not trello_notify_room
  try
    t = new Trello trello_key, trello_token
  catch e
    console.error e
    return onError?(e)

# Description:
#   Get notifications from trello for a given board.
#
# Dependencies:
#   "node-trello": "0.1.2"
