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

    Copyright (c) 2018, 2020 Oracle and/or its affiliates.

    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.

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

:javadoc-base-url-api: {javadoc-base-url}io.helidon.webserver/io/helidon/webserver
:description: Helidon Reactive Webserver Configuration
:keywords: helidon, reactive, reactive streams, reactive java, reactive webserver

= WebServer Configuration

Configure the WebServer either programmatically, or by the Helidon configuration framework.

== Configuring the WebServer in your code

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

[source,java]
----
WebServer webServer = WebServer.builder()
      .bindAddress(InetAddress.getLocalHost())
      .port(8080)
      .build();
----

== Configuring the WebServer in a configuration file

You can also define the configuration in a file.

[source,yaml]
.WebServer configuration file `application.yaml`
----
server:
  port: 8080
  bind-address: "0.0.0.0"
----

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

[source,java]
.WebServer initialization using the `application.yaml` file located on the classpath
----
Config config = Config.create(); // <1>
WebServer webServer = WebServer.create(routing, config.get("server")); // <2>
----

<1> `application.yaml` is a default configuration source loaded when YAML support is on classpath, so we can
just use `Config.create()`
<2> Server expects the configuration tree located on the node of `server`

== Configuration options

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