RichConfigOps

trait RichConfigOps extends Dynamic with LowPriorityArgs4cImplicits

Exposes new operations on a 'config'

trait Dynamic
class Object
trait Matchable
class Any

Value members

Abstract methods

def config: Config
Returns

the configuration for which we're providing additional functionality

Concrete methods

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

the configuration path

Returns

the value at the given key as a scala duration

def asFiniteDuration(key: String): FiniteDuration
def asJson: String
Returns

the configuration as a json string

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

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

the configuration as a map

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

the configuration as a set of key/value tuples

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

the encrypted configuration

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

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

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

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

def intersect(other: Config): Config
Returns

the configuration representing the intersection of the two configuration entries

def origins: List[String]
Returns

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

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

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

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.

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

all the unique paths for this configuration

def selectDynamic(path: String): Selected
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

def set(key: String, value: String): Config
def set(key: String, value: Boolean): Config
def set(values: Map[String, Any], originDesc: String): Config
def setArray[T](key: String, firstValue: T, secondValue: T, theRest: T*): Config
def setArray[T](key: String, value: Seq[T], originDesc: String): Config
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

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

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

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

def toMap: Map[String, ConfigValue]
Returns

the config as a map

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

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

this configuration which only contains the specified paths

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

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

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

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

the paths to remove

Returns

a new configuration with the given paths removed

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