RichConfig

class RichConfig(val config: Config) extends RichConfigOps

Adds some scala utility around a typesafe config

Companion
object
trait Dynamic
class Object
trait Matchable
class Any

Value members

Inherited methods

def asDuration(key: String): Duration
Value Params
key

the configuration path

Returns

the value at the given key as a scala duration

Inherited from
RichConfigOps
def asFiniteDuration(key: String): FiniteDuration
Inherited from
RichConfigOps
def asJson: String
Returns

the configuration as a json string

Inherited from
RichConfigOps
def asList(path: String, separator: Option[String]): List[String]

produces a scala list, either from a StringList or a comma-separated string value

produces a scala list, either from a StringList or a comma-separated string value

Value Params
path

the config path

separator

if specified, the value at the given path will be parsed if it is a string and not a stringlist

Inherited from
RichConfigOps
def collectAsMap(options: ConfigRenderOptions): Map[String, String]
Returns

the configuration as a map

Inherited from
RichConfigOps
def collectAsStrings(options: ConfigRenderOptions): Seq[(String, String)]
Returns

the configuration as a set of key/value tuples

Inherited from
RichConfigOps
def defaultRenderOptions: ConfigRenderOptions
Inherited from
RichConfigOps
def encrypt(password: Array[Byte]): Array[Byte]
Returns

the encrypted configuration

Inherited from
RichConfigOps
def entries(arraySyntax: Boolean): Set[(String, ConfigValue)]
Value Params
arraySyntax

if true expand arrays with '.[x]' syntax

Returns

the configuration entries as a set of entries

Inherited from
RichConfigOps
def filter(pathFilter: String => Boolean): Config
Value Params
pathFilter

a predicate used to determine if the configuration path should be kept

Returns

a new configuration which just keeps the paths which include the provided path predicate

Inherited from
RichConfigOps
def filterNot(pathFilter: String => Boolean): Config
Value Params
pathFilter

a predicate used to determine if the configuration path should be kept

Returns

a new configuration which just keeps the paths which do NOT include the provided path predicate

Inherited from
RichConfigOps
def hasValue(path: String): Boolean
Value Params
path

the config path

Returns

true if the config path is set in this config to a non-empty value. This will error if the path specified is an object or a list

Inherited from
RichConfigOps
def intersect(other: Config): Config
Returns

the configuration representing the intersection of the two configuration entries

Inherited from
RichConfigOps
def origins: List[String]
Returns

a sorted list of the origins from when the config values come

Inherited from
RichConfigOps
def overrideWith(configString: String): Config
Value Params
configString

the configuration (as a string) which should override this config -- essentially the inverse of 'withFallback'

Returns

a new configuration based on 'configString' with our config as a fallback

Inherited from
RichConfigOps
def overrideWith(overrideConfig: Config): Config
Value Params
overrideConfig

the configuration (as a string) which should override this config -- essentially the inverse of 'withFallback'

Returns

a new configuration based on 'configString' with our config as a fallback

Inherited from
RichConfigOps
def pathRoots: Seq[String]

The available config roots.

The available config roots.

e.g. of a config has

 foo.bar.x = 1
 java.home = /etc/java
 bar.enabled = true
 bar.user = root

The 'pathRoots' would return a [bar, foo, java]

Returns

a sorted list of the root entries to the config.

Inherited from
RichConfigOps
def paths(arraySyntax: Boolean): Seq[String]
Returns

all the unique paths for this configuration

Inherited from
RichConfigOps
def selectDynamic(path: String): Selected
Inherited from
RichConfigOps
def set(values: Map[String, Any], originDesc: String): Config
Inherited from
RichConfigOps
def set(key: String, value: Boolean): Config
Inherited from
RichConfigOps
def set(key: String, value: String): Config
Inherited from
RichConfigOps
def set(key: String, value: Long): Config
Value Params
key

the config path

value

the value to set

Returns

a new configuration based on 'configString' with our config as a fallback

Inherited from
RichConfigOps
def setArray[T](key: String, value: Seq[T], originDesc: String): Config
Inherited from
RichConfigOps
def setArray[T](key: String, firstValue: T, secondValue: T, theRest: T*): Config
Inherited from
RichConfigOps
def showIfSpecified(obscure: (String, String) => String): Option[String]

If 'show=X' is specified, configuration values which contain X in their path will be displayed with the values matching 'obscure' obscured.

If 'show=X' is specified, configuration values which contain X in their path will be displayed with the values matching 'obscure' obscured.

If 'X' is 'all' or 'root', then the entire configuration is rendered.

This can be useful to debug other command-line args (to ensure they take the desired effect) or to validate the environment variable replacement

Value Params
obscure

a function which takes a dotted configuration path and string value and returns the value to display

Returns

the optional value of what's pointed to if 'show=' is specified

Inherited from
RichConfigOps
def summary(prefix: String, obscure: (String, String) => String): String

Return a property-like summary of the config using the pathFilter to trim property entries

Return a property-like summary of the config using the pathFilter to trim property entries

Value Params
obscure

a function which will 'safely' replace any config values with an obscured value

Returns

a summary of the configuration

Inherited from
RichConfigOps
def summaryAtPath(path: String, obscure: (String, String) => String): String
Value Params
obscure

an obscure function

path

the path to a subconfig

Returns

the summary at the given path

Inherited from
RichConfigOps
def summaryEntries(obscure: (String, String) => String): Seq[StringEntry]

Return a property-like summary of the config using the 'obscure' function to mask sensitive entries

Return a property-like summary of the config using the 'obscure' function to mask sensitive entries

Value Params
obscure

a function which will 'safely' replace any config values with an obscured value

Inherited from
RichConfigOps
def toMap: Map[String, ConfigValue]
Returns

the config as a map

Inherited from
RichConfigOps
def withPaths(paths: Seq[String]): Config
Returns

this configuration which only contains the specified paths

Inherited from
RichConfigOps
def withPaths(first: String, theRest: String*): Config
Value Params
first

the first path to include (keep)

theRest

any other paths to keep

Returns

this configuration which only contains the specified paths

Inherited from
RichConfigOps
def withUserArgs(args: Array[String], unrecognizedArg: String => Config): Config

Overlay the given arguments over this configuration, where the arguments are taken to be in the form:

Overlay the given arguments over this configuration, where the arguments are taken to be in the form:

$ the path to a configuration file, either on the classpath or file system $ a = pair where the key is a 'path.to.a.configuration.entry'

Value Params
args

the user arguments in the form =, or

unrecognizedArg

what to do with malformed user input

Returns

a configuration with the given user-argument overrides applied over top

Inherited from
RichConfigOps
def without(configPaths: IterableOnce[String]): Config
Value Params
configPaths

the paths to remove

Returns

a new configuration with the given paths removed

Inherited from
RichConfigOps
def without(firstPath: String, theRest: String*): Config
Value Params
firstPath

the first path to remove

theRest

the remaining paths to remove

Returns

a new configuration with the given paths removed

Inherited from
RichConfigOps
def without(other: Config): Config
Value Params
other

the configuration to remove from this config

Returns

a new configuration with all values from 'other' removed

Inherited from
RichConfigOps

Concrete fields

override
val config: Config

Extensions

Inherited extensions

extension (str: String)
def quoted: String
extension (userArgs: Array[String])
def asConfig(fallback: Config, onUnrecognizedArg: String => Config): Config
def asRichConfig(fallback: Config, onUnrecognizedArg: String => Config): RichConfig

Implicits

Inherited implicits

implicit