ProductPromotion
Logo

Kotlin

made by https://0x3d.site

GitHub - daviddenton/configur8: Nano-library which provides the ability to define typesafe (!) configuration templates for applications.
Nano-library which provides the ability to define typesafe (!) configuration templates for applications. - daviddenton/configur8
Visit Site

GitHub - daviddenton/configur8: Nano-library which provides the ability to define typesafe (!) configuration templates for applications.

GitHub - daviddenton/configur8: Nano-library which provides the ability to define typesafe (!) configuration templates for applications.

Configur8 Build Status Coverage Status Download Watch

Nano-library which provides the ability to define typesafe (!) Configuration templates for applications.

Concept:

A Configuration is a set of named and typed Property instances, which are defined using a ConfigurationTemplate. Each defined Property can be set with a default value, or be blank with a requirement to be overridden. At runtime, the template is reified into a concrete Configuration object, but if any properties are missing this process will throw a Misconfiguration error.

Assuming that the reification process is successful, property values can be retrieved in an (actually) type-safe manner, and are applied in the following descending order of precedence:

  1. JVM system property
  2. Named environment property
  3. Default value

Quick example

This is from the Kotlin version, but the Scala and Java APIs are broadly the same:

// simple typed values
val USER = Property.string("USER")
val AGE = Property.int("AGE")

// provide custom mapping functions to convert from strings to domain
val PATIENCE_LEVEL = Property("DURATION", { i: String -> Duration.parse(i) }, { it.describe() })

// build your template
val configTemplate = ConfigurationTemplate()
      .requiring(USER) // will be supplied by the environment
      .withProp(AGE, 2) // falls back to a default typed value
      .withProp(PATIENCE_LEVEL, Duration(10)) // custom typed property with default

// attempting to build a configuration with missing values will fail with a Misconfiguration exception
val config = configTemplate.reify()

// retrieval of values in a typesafe way
val patience: Duration = config.valueOf[PATIENCE_LEVEL]

Get it:

Currently, the library is published in Java, Kotlin and Scala versions in JCenter (and synced to Maven Central).

Maven:

Java:

<dependency>
  <groupId>io.github.daviddenton</groupId>
  <artifactId>configur8</artifactId>
  <version>1.7.0</version>
</dependency>

Kotlin:

<dependency>
  <groupId>io.github.daviddenton</groupId>
  <artifactId>konfigur8</artifactId>
  <version>1.7.0</version>
</dependency>

SBT:

libraryDependencies += "io.github.daviddenton" %% "configur8" % "1.7.0"

See it:

See the example code in scala or java or kotlin

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory