Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 1.94 KB

README.md

File metadata and controls

77 lines (51 loc) · 1.94 KB

Configuration parser and reader

License: MIT Build Status

Parse and read configurations in java. This package covers only parsing the configuration properties files and resolving the environment variables in these files.

Install

This package didn't upload to the maven central repository. Thus, for using this dependency you can use Jitpack.io.

1. Add the Jitpack repository to pom.xml

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

2. Add the di dependency to pom.xml

<dependency>
    <groupId>com.github.serveriev</groupId>
    <artifactId>configuration</artifactId>
    <version>v1.0</version>
</dependency>

How to use

1. Add a configuration file to the resource folder.

2. Load and read configuration.

import io.lenur.configuration.Configuration;

public class Application {

    public static void main(String[] args) {
        Configuration configuration = new Configuration("application.properties");
        System.out.println(configuration.get("database.username"));
        System.out.println(configuration.get("database.url"));
        String[] tech = configuration.getAsStringArray("technology.stack");//returns an array splitted by regex. default delimiter is | 
        String[] tech1 = configuration.getAsStringArray("technology.stack.regex", ",");//pass own delimiter
    }
}

Issues

✅ Parsing property files

❌ Parsing yaml files

❌ Parsing xml file

✅ Resolving environment variables

❌ Resolving system variables

Author

Lenur

License

Copyright © 2020 Lenur.

This project is MIT licensed.