///////////////////////////////////////////////////////////////////////////////

    Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

///////////////////////////////////////////////////////////////////////////////

= gRPC Server Configuration
:javadoc-base-url-api: {javadoc-base-url}?io/helidon/grpc/server
:pagename: grpc-server-configuration
:description: Helidon gRPC Server Configuration
:keywords: helidon, grpc, java, configuration

Configure the gRPC Server using the Helidon configuration framework, either programmatically
or via a configuration file.

== Configuring the gRPC Server in your code

The easiest way to configure the gRPC Server is in your application code.

[source,java]
----
GrpcServerConfiguration configuration = GrpcServerConfiguration.builder()
                                                       .port(8080)
                                                       .build();
GrpcServer grpcServer = GrpcServer.create(configuration, routing);
----

== Configuring the gRPC Server in a configuration file

You can also define the configuration in a file.

[source,hocon]
.GrpcServer configuration file `application.yaml`
----
grpcserver:
  port: 3333
----

Then, in your application code, load the configuration from that file.

[source,java]
.GrpcServer initialization using the `application.conf` file located on the classpath
----
GrpcServerConfiguration configuration = GrpcServerConfiguration.create(
        Config.builder()
              .sources(classpath("application.conf"))
              .build());

GrpcServer grpcServer = GrpcServer.create(configuration, routing);
----

== Configuration options

See all configuration options
 link:{javadoc-base-url-api}/GrpcServerConfiguration.html[here].

