8000 GitHub - elhub/common-konfig
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 21, 2024. It is now read-only.

elhub/common-konfig

Repository files navigation

Warning

This project has been archived and is no longer being actively developed by Elhub.

common-konfig

Table of Contents

About

common-konfig is a simple, extensible type-safe API for adding configuration properties from multiple sources to a Kotlin/Java project.

Getting Started

Prerequisites

A Kotlin or Java project.

Installation

Add the dependency to your project. For Gradle:

    implementation("no.elhub.common:common-konfig:${konfig-version})

Or maven:

        <dependency>
            <groupId>no.elhub.common</groupId>
            <artifactId>common-konfig</artifactId>
            <version>${konfig_version}</version>
        </dependency>

Usage

You can use common-konfig in a variety of ways, but the simplest way (in Kotlin) is simply to create an object that extends Configurable. For example:

import no.elhub.common.konfig.Configurable
import no.elhub.common.konfig.sources.ResourceFile

object MyConfiguration : Configurable(arrayOf(ResourceFile("my.properties"))) {
  val aProperty = property<String>("aProperty")
  val anotherProperty = property<Int>("another.property.with.weird.name")
  val thirdProperty = property<String>("databasename")
}

The configurable takes a number of PropertySource objects, with the precedence of the objects in the array reflecting the precedence the Configurable will give the properties in the code. Currently the project has only a few sources that it can handle, but it is easy to add new ones by implementing them for the PropertySource interface.

Testing

To test the module, run:

./gradlew test

Roadmap

See the open issues for a list of proposed features (and known issues).

This project still needs additional development to add support for more types, property sources, etc.

Contributing

Contributing, issues and feature requests are welcome. See the Contributing file.

Owners

This project is developed by Elhub. For the specific development group responsible for this code, see the Codeowners file.

License

This project is MIT licensed.

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Packages

No packages published
0