https://github.com/foogaro/conf4j
NS! A simple class to load system parameters or environment variables.
https://github.com/foogaro/conf4j
Last synced: 3 months ago
JSON representation
NS! A simple class to load system parameters or environment variables.
- Host: GitHub
- URL: https://github.com/foogaro/conf4j
- Owner: foogaro
- License: agpl-3.0
- Created: 2021-08-25T14:11:30.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T14:10:08.000Z (over 3 years ago)
- Last Synced: 2025-01-15T22:23:21.226Z (5 months ago)
- Language: Java
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CONF4J - Configuration for Java
A simple library to independently load system properties or environment variables.# Usage
## Maven
```xmlcom.foogaro.util
conf4j
1.0.0```
## Java
Basically, for system properties, instead of doing the following
```java
class Foo {
public static void main(String[] args)
{
String connUrl = System.getProperty("connection.url");
System.out.println(connUrl);
}
}
```
and for environment variables, instead of doing the following
```java
class Foo {
public static void main(String[] args)
{
String connUrl = System.getenv("connection.url");
System.out.println(connUrl);
}
}
```You can access your settings just doing the following
```java
import com.foogaro.util.Conf4J;class Foo {
public static void main(String[] args) {
String connUrl = Conf4J.get("connection.url");
System.out.println(connUrl);
}
}
```# Why
Since I moved to containers, most of the time I had to access application's configuration settings as system properties and/or environment variables.
I didn't look/google too much around, and it was easier to implement the Conf4J class.# Conclusion
There might be something more sophisticated out there, in that case, go for it.Ciao,
Luigi