Combo.Endpoint.BanditAdapter (combo v0.8.0)

View Source

The Bandit adapter for Combo.Endpoint.

To use this adapter, bandit should be installed as a dependency:

{:bandit, "~> 1.0"}

Once bandit is installed, set the :adapter option to your endpoint configuration. For example:

config :demo, Demo.Web.Endpoint,
  adapter: Combo.Endpoint.BanditAdapter

Good to know that it's the default adapter, so you don't have to set :adapter option.

Endpoint configuration

This adapter supports the structure for endpoint configuration.

Top-level keys for :http and :https are supported, and values within within each of those are interpreted as raw Bandit configuration as specified by Bandit.options/0.

It can be difficult to know exactly where to put the options that you may need to set from the ones available at Bandit.options/0. The general idea is that anything inside the http: or https: keyword lists in your configuration are passed directly to Bandit.start_link/1, so an example may look like so:

config :demo, Demo.Web.Endpoint,
  http: [
    ip: {127, 0, 0, 1},
    port: 4000,
    thousand_island_options: [num_acceptors: 123],
    http_options: [log_protocol_errors: false],
    http_1_options: [max_requests: 1],
    websocket_options: [compress: false]
  ]

Thanks

The original code comes from Bandit.PhoenixAdapter of bandit which is created by Mat Trudel.