@@ -10,7 +10,7 @@ defmodule GRPC.Server.Supervisor do
10
10
11
11
def start(_type, _args) do
12
12
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}], ...}]
14
14
15
15
Supervisor.start_link(children, strategy: :one_for_one, name: __MODULE__)
16
16
end
@@ -41,6 +41,7 @@ defmodule GRPC.Server.Supervisor do
41
41
* `:endpoint` - defines the endpoint module that will be started.
42
42
* `:port` - the HTTP port for the endpoint.
43
43
* `:servers` - the list of servers that will be be started.
44
+ * `:adapter_opts` - options for the adapter.
44
45
45
46
Either `:endpoint` or `:servers` must be present, but not both.
46
47
"""
@@ -60,7 +61,15 @@ defmodule GRPC.Server.Supervisor do
60
61
through the :start_server option for the GRPC.Server.Supervisor"
61
62
end
62
63
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
64
73
65
74
endpoint_or_servers =
66
75
case { opts [ :endpoint ] , opts [ :servers ] } do
0 commit comments