Combo.Endpoint.BanditAdapter (combo v0.11.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

Endpoint configuration

This adapter uses the following endpoint configuration:

  • :http - the configuration for the HTTP server. It accepts all options as defined by Bandit.options/0. Defaults to false.

  • :https - the configuration for the HTTPS server. It accepts all options as defined by Bandit.options/0. Defaults to false.

For example:

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

Connection draining

Bandit has built-in support of connection draining.

Thanks

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