Tagged Modular Configuration

Configuration library. Can composite modules together and further composite with tags

Лицензия

Лицензия

Группа

Группа

io.github.yeagy
Идентификатор

Идентификатор

tmc
Последняя версия

Последняя версия

0.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Tagged Modular Configuration
Configuration library. Can composite modules together and further composite with tags
Ссылка на сайт

Ссылка на сайт

https://github.com/yeagy/tmc
Система контроля версий

Система контроля версий

https://github.com/yeagy/tmc

Скачать tmc

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.github.yeagy/tmc/ -->
<dependency>
    <groupId>io.github.yeagy</groupId>
    <artifactId>tmc</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.yeagy/tmc/
implementation 'io.github.yeagy:tmc:0.2.0'
// https://jarcasting.com/artifacts/io.github.yeagy/tmc/
implementation ("io.github.yeagy:tmc:0.2.0")
'io.github.yeagy:tmc:jar:0.2.0'
<dependency org="io.github.yeagy" name="tmc" rev="0.2.0">
  <artifact name="tmc" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.yeagy', module='tmc', version='0.2.0')
)
libraryDependencies += "io.github.yeagy" % "tmc" % "0.2.0"
[io.github.yeagy/tmc "0.2.0"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
io.github.lukehutch : fast-classpath-scanner jar 2.21
com.fasterxml.jackson.core : jackson-databind jar 2.8.5
com.fasterxml.jackson.dataformat : jackson-dataformat-yaml jar 2.8.5
ru.vyarus : generics-resolver jar 3.0.0

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.projectlombok : lombok jar 1.16.12

Модули Проекта

Данный проект не имеет модулей.

Build Status Maven Central Javadocs

Tagged Modular Configuration

  • Java configuration library. Read and map your config file(s) to a POJO.
  • Modular: Reference other config files on the classpath to merge into your config.
  • Tagged: Define config blocks with tags to merge config at runtime.
  • Formats: JSON and YAML

Usage:

    MyConfig config = TaggedModularConfig.rootModule("main").applyTags("prod").create(MyConfig.class);
  • TMC modules have filename patterns <module name>.tmc.<format> (ex: main.tmc.json, config.tmc.yml)
  • Modules are referenced using the "_module" field name. The module file will be loaded and merged into the node the "_module" was found on.
  • Tags are defined on a module root using the "_tags" field name. Tags specified at runtime will be merged onto the module at the root level, so full paths are needed in tag blocks.
  • TMC modules can reference other modules. TMC will resolve modules recursively, and error if a cycle is detected. Tags can also contain modules.
  • Collision precedence order: root tags > root tree > module tags > module tree. Module tags will be resolved before the module is merged into it's parent tree. Module merging will not overwrite existing leafs of the parent module. Tag merging will overwrite existing leafs of the parent module. Multi-tag collisions will be won by the firstmost tag of the applied tag list.
//main.tmc.json
{
  "app": "example",
  "logging": {
    "level": "DEBUG",
    "enabled": true
  },
  "http": {
    "_module": "loadbalancer",
    "port": 8080
  },
  "_tags": {
    "prod": {
      "logging": {
        "level": "WARN"
      }
    }
  }
}
//loadbalancer.tmc.json
{
  "host": "localhost",
  "timeout": "5s",
  "_tags": {
    "prod": {
      "host": "lb.site.com"
    }
  }
}

Running TMC on the "main" module with the "prod" tag would create the config below.

{
  "app": "example",          //root tree
  "logging": {               //root tree
    "level": "WARN",         //root tag
    "enabled": true          //root tree
  },
  "http": {                  //root tree
    "host": "lb.site.com",   //module tag
    "timeout": "5s",         //module tree
    "port": 8080             //root tree
  }
}
<dependency>
  <groupId>io.github.yeagy</groupId>
  <artifactId>tmc</artifactId>
  <version>0.2.0</version>
</dependency>

Версии библиотеки

Версия
0.2.0
0.1.0