View Source Orbit.Endpoint (Orbit v0.3.0)

The main endpoint supervisor.

Usage

Define the module:

# lib/my_app_capsule/endpoint.ex
defmodule MyAppCapsule.Endpoint do
  use Orbit.Endpoint, otp_app: :my_app
  use Orbit.Router

  # ...define pipes and routes (see Orbit.Router docs)...
end

Then add config:

# config/config.exs
config :my_app, MyAppCapsule.Endpoint,
  certfile: "path/to/hostname.crt",
  keyfile: "path/to/hostname.key"

Finally, add it to the supervision tree:

# lib/my_app/application.ex
children = [
  MyAppCapsule.Endpoint
]

Options for use Orbit.Endpoint

Required

  • :otp_app - the OTP application name

Optional

  • :entrypoint - the initial pipe to handle incoming requests; defaults to the calling module

Configuration

Required

  • One of:

    • :certfile - path to a TLS certificatefile in the PEM format
    • :cert - a DER-encoded certificate binary
    • :cert_pem - a PEM-encoded certificate binary
  • One of:

    • :keyfile - path to a TLS private key file in the PEM format
    • :key - a DER-encoded private key binary
    • :key_pem - a PEM-encoded private key binary

Optional

  • :ip - the IP to listen on; defaults to "0.0.0.0"
  • :port - the port to listen on; defaults to 1965
  • :debug_errors - if true, returns stack traces for server errors; defaults to false

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns metadata about the capsule's TLS listener.

Starts the Capsule supervisor.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

listener_info(capsule_pid)

View Source

Returns metadata about the capsule's TLS listener.

Starts the Capsule supervisor.