Skip to content

gabrsar/DynamicSettings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic Settings

Build Status Codacy Badge License: MIT Download

Don't make deploys to change simple settings.

Simply put your settings on a database (only supports DynamoDB for now) and get it updated every minute.

How To use (Complete)

For examples on how to use, please check this Simple example application

How To Use (TL;DR)

  1. Add this to your pom.xml:
<dependencies>
    <dependency>
      <groupId>br.com.gabrielsaraiva.dynamicsettings</groupId>
      <artifactId>dynamic-settings</artifactId>
      <version>0.3.0</version>
    </dependency>
</dependencies>

<repositories>
  <repository>
    <id>jcenter</id>
    <url>https://jcenter.bintray.com/</url>
  </repository>
</repositories>
  1. In DyanmoDB create a new table called MySettings, with index set to module.

  2. Add an item with module value set to Home

  3. Create a class like that

public class Settings {
    public static class Home {
        public static final Setting<String> address = Setting.define("This is my house");
  }
}
  1. Add this in your project startup:
DynamoDBProvider dynamodbProvider = new DynamoDBProvider("MySettings");
DynamicSettings ds = new DynamicSettings(dynamodbProvider, 5, Settings.class);
ds.start();

SettingsReader settingsReader = new SettingsReader();

System.out.println(settingsReader.get(Settings.Home.address));
  1. Run it. Change your settings values in DynamoDB. Get it updated in your program.

Features

  • Support basic types
  • Support DynamoDB
  • Support Dummy Provider for Testing
  • Full test coverage
  • Make it testable inside host projects
  • JCenter
  • Maven Central
  • Support collections and maps
  • Extract dependencies into separated modules
  • Support for Redis
  • Support MySql
  • Support PostgreSql
  • Support for MongoDB

Suggestions and PullRequests are wellcome.