heimdall v0.2.0 Heimdall.Marathon.BingeWatch

There’s a Marathon playing, and we’re gonna BingeWatch it.

This module is for handling callback events from Marathon. Given any event it will query all running apps, and rebuild the dynmaic routes based on the labels of each app.

This module is also a plug, traffic from /marathon-callback is routed to call/2 by Heimdall.Router

Summary

Functions

Builds a route given a map that represents the Marathon config for an app. The config must have a labels map, as well as a heimdall.host and heimdall.path in the labels map

Converts a string to an elixir module atom. Will throw an argument error if the module does not exist. (There is no need to give a fully qualified erlang module name, just refer to it as you would in elixir)

Functions

build_route(app)

Builds a route given a map that represents the Marathon config for an app. The config must have a labels map, as well as a heimdall.host and heimdall.path in the labels map.

heimdall.filters and heimdall.opts are optional, they will default to an empty list and tuple respectively.

call(conn, opts)
init(opts)
reload_marathon_routes(marathon_url)
string_to_module(module_string)

Converts a string to an elixir module atom. Will throw an argument error if the module does not exist. (There is no need to give a fully qualified erlang module name, just refer to it as you would in elixir)

Examples

iex>Heimdall.Marathon.BingeWatch.string_to_module("Heimdall.Marathon.BingeWatch")
Heimdall.Marathon.BingeWatch