View Source MainProxy.Proxy behaviour (main_proxy v0.3.1)

Summary

Callbacks

Specify the backends to pass requests to at startup time. (Optional)

Merge cowboy config

Types

@type scheme() :: :http | :https

Callbacks

@callback backends() :: [map()]

Specify the backends to pass requests to at startup time. (Optional)

Overriding this callback allows for setting the backends to be matched at runtime when the proxy is starting up.

Example:

@impl MainProxy.Proxy
def backends do
  [
    %{
      domain: "https://myapp1.com",
      phoenix_endpoint: MyApp1Web.Endpoint
    },
    %{
      domain: "https://myapp2.com",
      phoenix_endpoint: MyApp2Web.Endpoint
    }
  ]
end
Link to this callback

merge_config(scheme, keyword)

View Source (optional)
@callback merge_config(
  scheme(),
  keyword()
) :: keyword()

Merge cowboy config

Overriding this callback allows the configuration from the application environment to be modified at runtime.