@@ -10,7 +10,7 @@ defmodule GRPC.Server.Supervisor do
1010
1111 def start(_type, _args) do
1212 children = [
13- {GRPC.Server.Supervisor, endpoint: Your.Endpoint, port: 50051, start_server: true, ...}]
13+ {GRPC.Server.Supervisor, endpoint: Your.Endpoint, port: 50051, start_server: true, adapter_opts: [ip: {0, 0, 0, 0}], ...}]
1414
1515 Supervisor.start_link(children, strategy: :one_for_one, name: __MODULE__)
1616 end
@@ -41,6 +41,7 @@ defmodule GRPC.Server.Supervisor do
4141 * `:endpoint` - defines the endpoint module that will be started.
4242 * `:port` - the HTTP port for the endpoint.
4343 * `:servers` - the list of servers that will be be started.
44+ * `:adapter_opts` - options for the adapter.
4445
4546 Either `:endpoint` or `:servers` must be present, but not both.
4647 """
@@ -60,7 +61,15 @@ defmodule GRPC.Server.Supervisor do
6061 through the :start_server option for the GRPC.Server.Supervisor"
6162 end
6263
63- opts = Keyword . validate! ( opts , [ :endpoint , :servers , :start_server , :port ] )
64+ opts =
65+ case Keyword . validate ( opts , [ :endpoint , :servers , :start_server , :port , :adapter_opts ] ) do
66+ { :ok , _opts } ->
67+ opts
68+
69+ { :error , _ } ->
70+ raise ArgumentError ,
71+ "just [:endpoint, :servers, :start_server, :port,] are accepted as arguments, and any other keys for adapters should be passed as adapter_opts!"
72+ end
6473
6574 endpoint_or_servers =
6675 case { opts [ :endpoint ] , opts [ :servers ] } do
0 commit comments