Skip to content

Parse startup parameters from environment variables and system options

License

Notifications You must be signed in to change notification settings

payneteasy/startup-parameters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI Quality Gate Status

Parse startup parameters

Features

  • supported types: int, String, File, boolean, char, long, Period, Duration, enums, BigDecimal
  • thread safe

Setup with dependency managers

Maven

<repositories>
    <repository>
        <id>pne</id>
        <name>payneteasy repo</name>
        <url>https://maven.pne.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.payneteasy</groupId>
        <artifactId>startup-parameters</artifactId>
        <version>1.0-10</version>
    </dependency>
</dependencies>

Gradle

compile 'com.payneteasy:startup-parameters:1.0-10'

How to use

❶ Create an interface with parameters, see example

public interface IStartupConfig {

    @AStartupParameter(name = "WEB_SERVER_PORT", value = "8083")
    int webServerPort();

    @AStartupParameter(name = "WEB_SERVER_CONTEXT", value = "/api")
    String webServerContext();

    @AStartupParameter(name = "REQUEST_LOG_DIR", value = "./logs")
    File getRequestLogDir();
}

❷ Create an instance, see example

    IStartupConfig startupConfig = StartupParametersFactory.getStartupParameters(IStartupConfig.class);
    int port = startupConfig.webServerPort();

Pretty log

SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();

License

The Startup Parameters library is licensed under the Apache License 2.0

About

Parse startup parameters from environment variables and system options

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages