Config Reader

A utility to read data from properties and yml files as HashMap<String, String>

License

License

Categories

Categories

config Application Layer Libs Configuration
GroupId

GroupId

dev.spiti.utilities
ArtifactId

ArtifactId

config-reader
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Config Reader
A utility to read data from properties and yml files as HashMap<String, String>
Project URL

Project URL

https://github.com/spiti-dev/config-reader
Source Code Management

Source Code Management

https://github.com/spiti-dev/config-reader

Download config-reader

How to add to project

<!-- https://jarcasting.com/artifacts/dev.spiti.utilities/config-reader/ -->
<dependency>
    <groupId>dev.spiti.utilities</groupId>
    <artifactId>config-reader</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/dev.spiti.utilities/config-reader/
implementation 'dev.spiti.utilities:config-reader:1.0.1'
// https://jarcasting.com/artifacts/dev.spiti.utilities/config-reader/
implementation ("dev.spiti.utilities:config-reader:1.0.1")
'dev.spiti.utilities:config-reader:jar:1.0.1'
<dependency org="dev.spiti.utilities" name="config-reader" rev="1.0.1">
  <artifact name="config-reader" type="jar" />
</dependency>
@Grapes(
@Grab(group='dev.spiti.utilities', module='config-reader', version='1.0.1')
)
libraryDependencies += "dev.spiti.utilities" % "config-reader" % "1.0.1"
[dev.spiti.utilities/config-reader "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.yaml : snakeyaml jar 1.20

Project Modules

There are no modules declared in this project.

Config Reader - Simple way to read configuration files

Contents

Key Features

  • Reads .properties and .yml files
  • Returns configs as a Map<String, String>
  • Merges environment and project configs

Environments

  • Default config file name is project (project.properties OR project.yml)
  • Environment names can be any String value

Limitations

  • Empty config files are not handled.

Examples

Read YML files

Map<String, String> properties = new YmlConfig("dev").getConfig();
  • Reads dev.yml and project.yml
  • Merges both files - environment property is considered to return when duplicate key exists
  • Returns the merged configuration as a Map<String, String>
Map<String, String> properties = new YmlConfig().getConfig();
  • Reads and returns project.yml

Read PROPERTIES files

Map<String, String> properties = new PropertyConfig("dev").getConfig();
  • Reads dev.properties and project.properties
  • Merges both files - environment property is considered to return when duplicate key exists
  • Returns the merged configuration as a Map<String, String>
Map<String, String> properties = new PropertyConfig().getConfig();
  • Reads and returns project.properties

Versions

Version
1.0.1
1.0.0