Skip to content

A flexible configuration management library for dynamically retrieving different types of configuration settings.

Notifications You must be signed in to change notification settings

Tofpu/dynamic-configuration

Repository files navigation

dynamic-configuration

A library that simplify the creation of multiple configuration types.

Getting started

Note: replace latest-version-here with the jitpack's version badge above.

Gradle DSL

  repositories {
    maven("https://jitpack.io")
    // ... other
  }

  dependencies {
    implementation("com.github.Tofpu:dynamic-configuration:latest-version-here")
    // ... other
  }

Maven

  <repositories>
    <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
    </repository>
  <!-- other -->
  </repositories>

<dependencies>
  <dependency>
    <groupId>com.github.Tofpu</groupId>
    <artifactId>dynamic-configuration</artifactId>
    <version>latest-version-here</version>
  </dependency>
  <!-- other -->
</dependencies>
Usage

Initialize

  // define your config types
  enum MyConfigTypes implements ConfigType {
        CONFIG("config"),
        MESSAGE("messages");

        private final String identifier;

        ConfigTypes(String identifier) {
            this.identifier = identifier;
        }

        @Override
        public String identifier() {
            return identifier;
        }
  }

  final File configDirectory = // this is where the configs will be located
  final DynamicConfigHandler configHandler = new DynamicConfigHandler(configDirectory);

  // pass down your custom defined config types here
  configHandler.load(MyConfigTypes.values());

Access

  Configuration config = configHandler.on(MyConfigTypes.CONFIG);

Further details

Until a proper document is in place, please refer to ConfigurationTest class in the meantime.

About

A flexible configuration management library for dynamically retrieving different types of configuration settings.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages