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

    Copyright (c) 2018, 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.

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

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

= WebServer Configuration

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

== Configuring the WebServer in your code

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

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

== Configuring the WebServer in a configuration file

You can also define the configuration in a file.

[source,hocon]
.WebServer configuration file `application.conf`
----
webserver {
  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.conf` file located on the classpath
----
ServerConfiguration configuration = ServerConfiguration.create(
        Config.builder()
              .sources(classpath("application.conf"))
              .build());

WebServer webServer = WebServer.create(configuration, routing);
----

== Configuration options

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