the runtime config to use containing all values to bind
If overridden, the namespace prefix that is prepended to all binding key names.
If overridden, the namespace prefix that is prepended to all binding key names. This is
used as a path prefix for all config values; so if the prefix is Some("foo")
and the config
key is "one.two", the final binding will be for @Named("foo.one.two").
This is useful if you're providing a module within a library, and want to have your clients be able to pass Config overrides without having to worry about prefixing them properly.
The filename to use for the default.
The filename to use for the default. Can be overridden for clarity.
Binds the config provided in the constructor, plus any default config found, and calls configureWithConfig with the resultant config object.
Binds the config provided in the constructor, plus any default config found, and calls configureWithConfig with the resultant config object.
Configure method for implementing classes to override if they wish to create additional bindings, or bindings based on config values.
Configure method for implementing classes to override if they wish to create additional bindings, or bindings based on config values.
the fully-initilized config object
The config to use as a fallback.
The config to use as a fallback. This is where keys will be looked up if they aren't present in the provided config.
Simple logback configuration.
Simple logback configuration.
Hopefully this will be discoverable by just typing loggerConfig.[TAB]
Examples:
loggerConfig.Logger("org.apache.spark").setLevel(Level.WARN)
loggerConfig.Logger().addAppender(
loggerConfig.newPatternLayoutEncoder("%-5level [%thread]: %message%n"),
loggerConfig.newConsoleAppender
)
Parent class for modules which use a typesafe config for values. This automatically binds all configuration values within a given Config instance, along with defaults from an optional bundled config file. Each binding is annotated with
@Named(configPath)
to differentiate multiple bindings for a single primitive type.This will bind config (HOCON) value types boolean, number, string, list, and object. Boolean and string entries are bound to the corresponding scala type. Numbers are bound to Double if they're floating point, and are bound to Int, Long, and Double if they're integral. Lists are bound to Seq[Config], since HOCON allows mixed list types. All object-valued keys are also bound as Config instances.
The default config filename is looked for in the implementing class's path, using the resource name
module.conf
. For example, if the implementing module is org.allenai.foobar.MyModule,module.conf
should be insrc/main/resources/org/allenai/foobar
.defaultConfig
provides the filename, if you want to change it from the default.Example config and bindings:
Config file -
Injected Scala class -