public static interface ServerConfig.Builder extends ConfigDataSpec
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_BASE_DIR_MARKER_FILE_PATH
The default name for the base dir sentinel properties file.
|
static String |
DEFAULT_ENV_PREFIX |
static String |
DEFAULT_PROP_PREFIX |
| Modifier and Type | Method and Description |
|---|---|
ServerConfig.Builder |
add(ConfigSource configSource)
Adds a configuration source.
|
ServerConfig.Builder |
address(InetAddress address)
Sets the address to bind to.
|
ServerConfig |
build()
Builds the server config.
|
ServerConfig.Builder |
configureObjectMapper(Action<ObjectMapper> action)
Configures the object mapper used for binding configuration data to arbitrary objects.
|
ServerConfig.Builder |
development(boolean development)
Whether or not the application is "development".
|
ServerConfig.Builder |
env()
Adds a configuration source for environment variables starting with the prefix .
|
ServerConfig.Builder |
env(EnvironmentParser environmentParser)
Adds a configuration source for environment variables using custom parsing logic.
|
ServerConfig.Builder |
env(String prefix)
Adds a configuration source for environment variables starting with the specified prefix.
|
ServerConfig.Builder |
env(String prefix,
Function<String,String> mapFunc)
Adds a configuration source for environment variables starting with the specified prefix.
|
ServerConfig.Builder |
json(ByteSource byteSource)
Adds a configuration source for a JSON file.
|
ServerConfig.Builder |
json(Path path)
Adds a configuration source for a JSON file.
|
ServerConfig.Builder |
json(String path)
Adds a configuration source for a JSON file.
|
ServerConfig.Builder |
json(URL url)
Adds a configuration source for a JSON file.
|
ServerConfig.Builder |
maxContentLength(int maxContentLength)
The max number of bytes a request body can be.
|
ServerConfig.Builder |
onError(Action<? super Throwable> errorHandler)
Sets the error handler that will be used for added configuration sources.
|
ServerConfig.Builder |
port(int port)
Sets the port to listen for requests on.
|
ServerConfig.Builder |
props(ByteSource byteSource)
Adds a configuration source for a properties file.
|
ServerConfig.Builder |
props(Map<String,String> map)
Adds a configuration source for a Map (flat key-value pairs).
|
ServerConfig.Builder |
props(Path path)
Adds a configuration source for a properties file.
|
ServerConfig.Builder |
props(Properties properties)
Adds a configuration source for a properties object.
|
ServerConfig.Builder |
props(String path)
Adds a configuration source for a properties file.
|
ServerConfig.Builder |
props(URL url)
Adds a configuration source for a properties file.
|
ServerConfig.Builder |
publicAddress(URI publicAddress)
The public address of the application.
|
ServerConfig.Builder |
ssl(SSLContext sslContext)
The SSL context to use if the application serves content over HTTPS.
|
ServerConfig.Builder |
sysProps()
Adds a configuration source for system properties starting with the prefix
|
ServerConfig.Builder |
sysProps(String prefix)
Adds a configuration source for system properties starting with the specified prefix.
|
ServerConfig.Builder |
threads(int threads)
The number of threads to use.
|
ServerConfig.Builder |
yaml(ByteSource byteSource)
Adds a configuration source for a YAML file.
|
ServerConfig.Builder |
yaml(Path path)
Adds a configuration source for a YAML file.
|
ServerConfig.Builder |
yaml(String path)
Adds a configuration source for a YAML file.
|
ServerConfig.Builder |
yaml(URL url)
Adds a configuration source for a YAML file.
|
getConfigSources, getObjectMapperstatic final String DEFAULT_ENV_PREFIX
static final String DEFAULT_PROP_PREFIX
static final String DEFAULT_BASE_DIR_MARKER_FILE_PATH
Value: ".ratpack"
ServerConfig.findBaseDir(),
Constant Field ValuesServerConfig.Builder port(int port)
Defaults to .
port - the port to listen for requests onthisServerConfig.getPort()ServerConfig.Builder address(InetAddress address)
Default value is null.
address - The address to bind tothisServerConfig.getAddress()ServerConfig.Builder development(boolean development)
Default value is false.
development - Whether or not the application is "development".thisServerConfig.isDevelopment()ServerConfig.Builder threads(int threads)
Defaults to ServerConfig.DEFAULT_THREADS
threads - the size of the event loop thread poolthisServerConfig.getThreads()ServerConfig.Builder publicAddress(URI publicAddress)
Default value is null.
publicAddress - the public address of the applicationthisServerConfig.getPublicAddress()ServerConfig.Builder maxContentLength(int maxContentLength)
1048576 (1 megabyte).maxContentLength - the max content length to acceptthisServerConfig.getMaxContentLength()ServerConfig.Builder ssl(SSLContext sslContext)
sslContext - the SSL contextthisSSLContexts,
ServerConfig.getSSLContext()ServerConfig.Builder env()
env in interface ConfigDataSpecthisServerConfig.Builder env(String prefix)
env in interface ConfigDataSpecprefix - the prefix which should be used to identify relevant environment variables;
the prefix will be removed before loading the datathisServerConfig.Builder props(ByteSource byteSource)
props in interface ConfigDataSpecbyteSource - the source of the properties datathisServerConfig.Builder props(String path)
props in interface ConfigDataSpecpath - the source of the properties datathisServerConfig.Builder props(Path path)
props in interface ConfigDataSpecpath - the source of the properties datathisServerConfig.Builder props(Properties properties)
props in interface ConfigDataSpecproperties - the properties objectthisServerConfig.Builder props(Map<String,String> map)
props in interface ConfigDataSpecmap - the mapthisServerConfig.Builder props(URL url)
props in interface ConfigDataSpecurl - the source of the properties datathisServerConfig.Builder sysProps()
sysProps in interface ConfigDataSpecthisServerConfig.Builder sysProps(String prefix)
sysProps in interface ConfigDataSpecprefix - the prefix which should be used to identify relevant system properties;
the prefix will be removed before loading the datathisServerConfig.Builder onError(Action<? super Throwable> errorHandler)
ConfigDataSpeconError in interface ConfigDataSpecerrorHandler - the error handlerAction.noop(),
Action.throwException()ServerConfig.Builder configureObjectMapper(Action<ObjectMapper> action)
ConfigDataSpecconfigureObjectMapper in interface ConfigDataSpecaction - an action to perform upon the object mapperServerConfig.Builder add(ConfigSource configSource)
ConfigDataSpecadd in interface ConfigDataSpecconfigSource - the configuration source to addServerConfig.Builder env(String prefix, Function<String,String> mapFunc)
ConfigDataSpecenv in interface ConfigDataSpecprefix - the prefix which should be used to identify relevant environment variablesmapFunc - the function to transform segments into field namesServerConfig.Builder env(EnvironmentParser environmentParser)
ConfigDataSpecenv in interface ConfigDataSpecenvironmentParser - the parser to use to interpret environment variablesServerConfig.Builder json(ByteSource byteSource)
ConfigDataSpecjson in interface ConfigDataSpecbyteSource - the source of the JSON dataServerConfig.Builder json(Path path)
ConfigDataSpecjson in interface ConfigDataSpecpath - the source of the JSON dataServerConfig.Builder json(String path)
ConfigDataSpecjson in interface ConfigDataSpecpath - the path to the source of the JSON dataServerConfig.Builder json(URL url)
ConfigDataSpecjson in interface ConfigDataSpecurl - the source of the JSON dataServerConfig.Builder yaml(ByteSource byteSource)
ConfigDataSpecyaml in interface ConfigDataSpecbyteSource - the source of the YAML dataServerConfig.Builder yaml(Path path)
ConfigDataSpecyaml in interface ConfigDataSpecpath - the source of the YAML dataServerConfig.Builder yaml(String path)
ConfigDataSpecyaml in interface ConfigDataSpecpath - the path to the source of the YAML dataServerConfig.Builder yaml(URL url)
ConfigDataSpecyaml in interface ConfigDataSpecurl - the source of the YAML dataServerConfig build()
build in interface ConfigDataSpec