Current section
Files
Jump to
Current section
Files
lib/reverse_proxy.ex
defmodule ReverseProxy do
@moduledoc """
`ReverseProxy` is our main application and supervisor.
It takes care of starting our plug based proxy service.
Here we want to load any other services like load balancing
and caching.
"""
use Application
require Logger
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
worker(ReverseProxy.LoadBalancer, [upstreams()])
]
opts = [strategy: :one_for_one, name: ReverseProxy.Supervisor]
Supervisor.start_link(children, opts)
end
defp upstreams() do
Application.get_env(:rexy, :upstreams, %{})
end
end