https://github.com/theangrydev/dynamic-configuration
https://github.com/theangrydev/dynamic-configuration
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/theangrydev/dynamic-configuration
- Owner: theangrydev
- License: apache-2.0
- Created: 2022-05-25T13:45:06.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2019-11-05T07:19:27.000Z (over 5 years ago)
- Last Synced: 2025-02-09T16:42:51.901Z (3 months ago)
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Configuration
The Configuration library is a clean (no external dependencies) Java implementation inspired by and partly based on work
found in the Constretto library: https://github.com/constretto/constretto-coreThis library contains a simple configuration loading and override mechanism capable of reading properties files from
file-system or classpath and also ability to read configuration from environment and java system properties.Example:
```properties
# application.properties
host=localhost
port=28282
accesslog.enabled=true
```
```java
// Sample Java application using configuration librarypublic class MyApp {
public static void main(String[] args) {
DynamicConfiguration configuration = new StoreBasedDynamicConfiguration.Builder()
.propertiesResource("application.properties")
.propertiesResource("application_override.properties")
.environment("MYAPP_")
.systemProperties()
.build();String host = configuration.evaluateToString("host");
int port = configuration.evaluateToInt("port");
boolean accessLogEnabled = configuration.evaluateToBoolean("accesslog.enabled");new MyWebServer(host, port, accessLogEnabled);
}
}
```