# `GRPC.Server.Supervisor`
[🔗](https://github.com/elixir-grpc/grpc_server/blob/v1.0.1/lib/grpc/server/supervisor.ex#L1)

A simple supervisor to start your servers.

You can add it to your OTP tree as below.
To start the server, you can pass `start_server: true` and an option

    defmodule Your.App do
      use Application

      def start(_type, _args) do
        children = [
          {GRPC.Server.Supervisor, endpoint: Your.Endpoint, port: 50051, start_server: true, adapter_opts: [ip: {0, 0, 0, 0}], ...}]

        Supervisor.start_link(children, strategy: :one_for_one, name: __MODULE__)
      end
    end

# `sup_flags`

```elixir
@type sup_flags() :: %{
  strategy: Supervisor.strategy(),
  intensity: non_neg_integer(),
  period: pos_integer(),
  auto_shutdown: Supervisor.auto_shutdown()
}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `child_spec`

```elixir
@spec child_spec(
  endpoint_or_servers :: atom() | [atom()],
  port :: integer(),
  opts :: keyword()
) ::
  Supervisor.Spec.spec()
```

Return a child_spec to start server.

## Options

  * `:cred` - a credential created by functions of `GRPC.Credential`,
    an insecure server will be created without this option
  * `:start_server` - determines if the server will be started.
    If present, has more precedence then the `config :gprc, :start_server`
    config value (i.e. `start_server: false` will not start the server in any case).

# `init`

```elixir
@spec init(tuple()) :: no_return()
@spec init(keyword()) :: {:ok, {sup_flags(), [Supervisor.child_spec()]}} | :ignore
```

## Options

  * `:endpoint` - defines the endpoint module that will be started.
  * `:port` - the HTTP port for the endpoint.
  * `:servers` - the list of servers that will be be started.
  * `:exception_log_filter` - a `{module, function :: atom}` tuple that refers to a filter function of arity 1.
    This function will be called with a `GRPC.Server.Adapters.ReportException` struct and must return a boolean
    indicating whether or not a given exception should be logged or dropped. Defaults to `nil`, which means all exceptions will be logged.
  * `:adapter_opts` - options for the adapter.
  * `:max_body_size` - the maximum message body size to accept in bytes

Either `:endpoint` or `:servers` must be present, but not both.

# `start_link`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
