Configuration

play.api.Configuration
See theConfiguration companion object
case class Configuration(underlying: Config)

A full configuration set.

The underlying implementation is provided by https://github.com/typesafehub/config.

Value parameters

underlying

the underlying Config implementation

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def entrySet: Set[(String, ConfigValue)]

Returns every path as a set of key to value pairs, by recursively iterating through the config objects.

Returns every path as a set of key to value pairs, by recursively iterating through the config objects.

Attributes

def get[A](path: String)(implicit loader: ConfigLoader[A]): A

Get the config at the given path.

Get the config at the given path.

Attributes

def getAndValidate[A](path: String, values: Set[A])(implicit loader: ConfigLoader[A]): A

Get the config at the given path and validate against a set of valid values.

Get the config at the given path and validate against a set of valid values.

Attributes

def getDeprecated[A : ConfigLoader](path: String, deprecatedPaths: String*): A

Get a deprecated configuration item.

Get a deprecated configuration item.

If the deprecated configuration item is defined, it will be returned, and a warning will be logged.

Otherwise, the configuration from path will be looked up.

Attributes

def getDeprecatedWithFallback(path: String, deprecated: String, parent: String): Configuration

Get a deprecated configuration.

Get a deprecated configuration.

If the deprecated configuration is defined, it will be returned, falling back to the new configuration, and a warning will be logged.

Otherwise, the configuration from path will be looked up and used as is.

Attributes

def getMillis(path: String): Long

Retrieves a configuration value as Milliseconds.

Retrieves a configuration value as Milliseconds.

For example:

val configuration = Configuration.load()
val timeout = configuration.getMillis("engine.timeout")

The configuration must be provided as:

engine.timeout = 1 second

Attributes

def getNanos(path: String): Long

Retrieves a configuration value as Milliseconds.

Retrieves a configuration value as Milliseconds.

For example:

val configuration = Configuration.load()
val timeout = configuration.getNanos("engine.timeout")

The configuration must be provided as:

engine.timeout = 1 second

Attributes

def getOptional[A](path: String)(implicit loader: ConfigLoader[A]): Option[A]

Get a value that may either not exist or be null. Note that this is not generally considered idiomatic Config usage. Instead you should define all config keys in a reference.conf file.

Get a value that may either not exist or be null. Note that this is not generally considered idiomatic Config usage. Instead you should define all config keys in a reference.conf file.

Attributes

def getPrototypedMap(path: String, prototypePath: String): Map[String, Configuration]

Get a prototyped map of objects.

Get a prototyped map of objects.

Each value in the map will fallback to the object loaded from prototype.$path.

Attributes

def getPrototypedSeq(path: String, prototypePath: String): Seq[Configuration]

Get a prototyped sequence of objects.

Get a prototyped sequence of objects.

Each object in the sequence will fallback to the object loaded from prototype.$path.

Attributes

Creates a configuration error for this configuration.

Creates a configuration error for this configuration.

For example:

val configuration = Configuration.load()
throw configuration.globalError("Missing configuration key: [yop.url]")

Value parameters

e

the related exception

message

the error message

Attributes

Returns

a configuration exception

def has(path: String): Boolean

Check if the given path exists.

Check if the given path exists.

Attributes

def keys: Set[String]

Returns available keys.

Returns available keys.

For example:

val configuration = Configuration.load()
val keys = configuration.keys

Attributes

Returns

the set of keys available in this configuration

def reportError(path: String, message: String, e: Option[Throwable]): PlayException

Creates a configuration error for a specific configuration key.

Creates a configuration error for a specific configuration key.

For example:

val configuration = Configuration.load()
throw configuration.reportError("engine.connectionUrl", "Cannot connect!")

Value parameters

e

the related exception

message

the error message

path

the configuration key, related to this error

Attributes

Returns

a configuration exception

Returns sub-keys.

Returns sub-keys.

For example:

val configuration = Configuration.load()
val subKeys = configuration.subKeys

Attributes

Returns

the set of direct sub-keys available in this configuration

Merge two configurations. The second configuration will act as the fallback for the first configuration.

Merge two configurations. The second configuration will act as the fallback for the first configuration.

Attributes

Deprecated methods

Merge two configurations. The second configuration overrides the first configuration. This is the opposite direction of Config's withFallback method.

Merge two configurations. The second configuration overrides the first configuration. This is the opposite direction of Config's withFallback method.

Attributes

Deprecated
[Since version 2.8.0]

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product