gRPC server configuration, read from application env into a struct:
config :hyper, Hyper.Cfg.Grpc,
enabled: true,
port: 50_051,
cred: GRPC.Credential.new(ssl: [certfile: "/path/cert.pem", keyfile: "/path/key.pem"])Fields:
:enabled-- whether the server starts. Defaults tofalse.:port-- the listen port. Defaults to50051.:cred-- aGRPC.Credentialfor TLS, ornil(the default) for plaintext.:adapter_opts-- options forwarded to the server adapter, e.g.[ip: {0, 0, 0, 0}].
Build the credential where you load your keys (e.g. config/runtime.exs);
Hyper never reads the filesystem on your behalf.
Each field also reads from the [grpc] table of config.toml when not set in
config.exs. There, cred is given as an inline table
{ cert = "/path/cert.pem", key = "/path/key.pem" }, which is coerced into a
GRPC.Credential.
Co-located nodes
Every node binds :port. Running multiple nodes on one host (e.g. a local
cluster) requires giving each a distinct port via its own config.
Summary
Functions
Load the gRPC server configuration: config.exs > [grpc] toml > defaults.
The GRPC.Server.Supervisor options for this config: the endpoint and port,
plus the TLS credential and adapter options when set.
Types
@type t() :: %Hyper.Cfg.Grpc{ adapter_opts: keyword(), cred: GRPC.Credential.t() | nil, enabled: boolean(), port: :inet.port_number() }
Functions
@spec load() :: t()
Load the gRPC server configuration: config.exs > [grpc] toml > defaults.
The GRPC.Server.Supervisor options for this config: the endpoint and port,
plus the TLS credential and adapter options when set.