gs-config/src/main/scala/gs/config/v0/ConfigKey.scala
Pat Garrity e44334b364
All checks were successful
/ Build and Release Library (push) Successful in 2m11s
(minor) Version, Doc, and Minor updates. (#2)
Reviewed-on: #2
2025-03-23 15:34:25 +00:00

41 lines
1.1 KiB
Scala

package gs.config.v0
/** Defines some piece of configuration.
*
* See:
*
* - [[ConfigKey.Required]]
* - [[ConfigKey.WithDefaultValue]]
*
* @tparam A
* The type of data referenced by this key. This type must be
* [[Configurable]].
*/
sealed trait ConfigKey[A: Configurable]:
def name: ConfigName
object ConfigKey:
/** Defines a piece of configuration that is required and does not have any
* default value. If the value referenced by the name cannot be found, an
* [[ConfigError.MissingValue]] is returned.
*
* @param name
* The name of this configuration.
*/
case class Required[A: Configurable](
name: ConfigName
) extends ConfigKey[A]
/** Defines a piece of configuration that has a default value. If the value
* referenced by the name cannot be found, the default is used.
*
* @param name
* The name of this piece of configuration.
* @param defaultValue
* The default value for this configuration.
*/
case class WithDefaultValue[A: Configurable](
name: ConfigName,
defaultValue: () => A
) extends ConfigKey[A]