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

Related tags

App configur8
Overview

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

Comments
  • Allow configuration from map instead of env

    Allow configuration from map instead of env

    This allows for better testability of http4k serverless applications that use the AppLoader. Adds a new method reifyFrom that reifies the configuration template from a map instead of getting the values from env/sysprops.

    object AWSLambda : AppLoader {
        override fun invoke(env: Map<String, String>): HttpHandler {
            val config = ConfigurationTemplate().reifyFrom(env)
            
            return routes("/api" bind API(config))
        }
    }
    opened by joscha-alisch 0
  • Making configuration template immutable.

    Making configuration template immutable.

    Sorry I've only done this for the java version - am happy to have a crack at the kotlin & scala versions. The test isn't as clean as it maybe could be.

    opened by stuartervine 0
  • Bump handlebars from 4.1.0 to 4.7.6 in /javascript

    Bump handlebars from 4.1.0 to 4.7.6 in /javascript

    Bumps handlebars from 4.1.0 to 4.7.6.

    Changelog

    Sourced from handlebars's changelog.

    v4.7.6 - April 3rd, 2020

    Chore/Housekeeping:

    Compatibility notes:

    • Restored Node.js compatibility

    Commits

    v4.7.5 - April 2nd, 2020

    Chore/Housekeeping:

    • Node.js version support has been changed to v6+ Reverted in 4.7.6

    Compatibility notes:

    • Node.js < v6 is no longer supported Reverted in 4.7.6

    Commits

    v4.7.4 - April 1st, 2020

    Chore/Housekeeping:

    Compatibility notes:

    • No incompatibilities are to be expected

    Commits

    v4.7.3 - February 5th, 2020

    Chore/Housekeeping:

    • #1644 - Download links to aws broken on handlebarsjs.com - access denied (@Tea56)
    • Fix spelling and punctuation in changelog - d78cc73

    Bugfixes:

    • Add Type Definition for Handlebars.VERSION, Fixes #1647 - 4de51fe
    • Include Type Definition for runtime.js in Package - a32d05f

    Compatibility notes:

    Commits
    Maintainer changes

    This version was pushed to npm by erisds, a new releaser for handlebars since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump acorn from 5.7.3 to 5.7.4 in /javascript

    Bump acorn from 5.7.3 to 5.7.4 in /javascript

    Bumps acorn from 5.7.3 to 5.7.4.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump lodash from 4.17.11 to 4.17.20 in /javascript

    Bump lodash from 4.17.11 to 4.17.20 in /javascript

    Bumps lodash from 4.17.11 to 4.17.20.

    Commits
    Maintainer changes

    This version was pushed to npm by bnjmnt4n, a new releaser for lodash since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • The Property class is the key of the Map in Configuration class but it doesn't override hashcode and equals methods.

    The Property class is the key of the Map in Configuration class but it doesn't override hashcode and equals methods.

    It is not possible to retrieve a property's value from the Configuration object if the reference to the original property object used in ConfigurationTemplate is lost.

    eg: fun main(args: Array) { val config = ConfigurationTemplate().withProp(Property.string("MY_PROP"),"myprop").reify() val propValue = config.get(Property.string("MY_PROP")) println(propValue) }

    gives Exception in thread "main" io.github.konfigur8.Misconfiguration: Unknown configuration key 'MY_PROP' Instead, it should provide the value from environment or the default "myprop"

    opened by gitika-bansal 0
  • What's the behavior for hyphenated properties?

    What's the behavior for hyphenated properties?

    What does a property foo-bar translate to in the code? Typesafe config encourages hyphenated properties over camelcase, but I couldn't find the answer to this question.

    opened by asarkar 0
Owner
David Denton
Polyglot // Open Source // Trainer // Speaker // Kotlin GDE // Co-creator of http4k
David Denton
Sharkur is a fork of Purpur which adds more configuration and also some optimalization.

Sharkur Sharkur is a fork of Purpur which adds more configuration and also some optimization. API Javadoc Dependency Information Maven <repository>

SharkurMC 8 Aug 1, 2022
⌨️ A tool that gives you a massive head start when building Compose based apps. It saves you from time-consuming setup and configuration

⌨️ A tool that gives you a massive head start when building Compose based apps. It saves you from time-consuming setup and configuration

theapache64 467 Dec 23, 2022
simple-flank is a Gradle plugin to use Flank in Android projects with no configuration needed

simple-flank simple-flank is a new gradle plugin with a clear focus: make the setup as simple as possible. Applied to any application or library modul

Flank 8 May 10, 2022
Olalekan Fagbemi 0 Nov 7, 2021
Conscrypt Provider app, which can be included from other applications (WIP)

Conscrypt Provider is an APK which can provide the Conscrypt Library to apps that support older Android devices. The Conscrypt Library provides modern

mendhak 8 Oct 1, 2022
StaCoAn is a crossplatform tool which aids developers, bugbounty hunters and ethical hackers performing static code analysis on mobile applications.

StaCoAn Not maintained anymore! Will be archived soon. StaCoAn is a crossplatform tool which aids developers, bugbounty hunters and ethical hackers pe

Vincent Cox 769 Dec 31, 2022
Andorid app which provides a bunch of useful Linux commands.

Linux Command Library for Android The app currently has 3203 manual pages, 1351 one-line scripts and a bunch of general terminal tips. It works 100% o

Simon Schubert 285 Jan 3, 2023
An Android Application which provides meanings for words searched.

An Android Application which provides meanings for words searched. It also displays some examples, synonyms and antonyms of the searched word.

Siddharth Singh 2 Aug 8, 2022
This service provides first-class custom ROM integration for my Repainter app, which offers customizable dynamic theming for Android 12.

Repainter ROM integration This service provides first-class custom ROM integration for my Repainter app, which offers customizable dynamic theming for

Danny Lin 42 Jan 7, 2023
Changelog - a android library, it helps developers display the history of changes in their applications

Changelog is a android library, it helps developers display the history of changes in their applications. Supports Locales, Layout direction

Amirhosein Barati 2 Aug 1, 2022
A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library.

Expo Music Picker A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library. Supp

Bartłomiej Klocek 60 Dec 29, 2022
Examples of Android applications

Android Demos This is a collection of basic android examples created by Novoda. CarouselFragment CompassExample ContactSelector CustomActivityTransiti

Novoda 2k Dec 16, 2022
An open source application to make your own android applications without coding!

Stif An Open source project for building Android Application at a go both with and without coding. This project was inspired from Scratch and Sketchwa

Nethical org 5 Aug 28, 2021
Android Kotlin Completed Training Applications.

Android Kotlin Completed Training Applications. This Repo is used to track a series of Android Kotlin apps I've created based on Google & Udacity trai

Tc2r 3 Dec 4, 2021
The application is a PoC that helps in identifying modern bankers, potentially malicious and remote controlling applications abusing Android AccessibilityService.

Motivation Project aims to help in: identifying keyloggers and events hijacking malicious applications such as Anubis/TeaBot, identifying a "fake bank

Krzysztof Pranczk 33 Dec 9, 2022
A framework for building native applications using React

React Native Learn once, write anywhere: Build mobile apps with React. Getting Started · Learn the Basics · Showcase · Contribute · Community · Suppor

Meta 106.9k Jan 8, 2023
This app aims at helping people keep track of their job applications, and remind them regularly about the same.

Applications Tracker Lately I have been applying for many roles, and it has become a hard task to keep track of all the applications. Spreadsheets are

Kartik Pant 4 Feb 20, 2022
Android Study Jams - These are applications built for Android Study Jams 2022 at Chitkara University

Project Description These are applications built for Android Study Jams 2022 at

Armaan Jain 3 Sep 16, 2022
A plugin for Termux to use native Android GUI components from CLI applications.

Termux:GUI This is a plugin for Termux that enables command line programs to use the native android GUI. In the examples directory you can find demo v

Termux 345 Jan 1, 2023