Releases: advantageous/konf
Konf Java configuration with JSON, YAML and JavaScript version 1.3.6.RELEASE
We opened up the resource management when we create konf-boon-json, konf-yaml-bean, and konf-typesafe-conf.
We did this so we did not have to repeat this code. We also support number handling better.
Konf Java configuration with JSON, YAML and JavaScript version 1.3.0.RELEASE
We also found out on our own project that we were missing getBoolean(path)
and getBooleanList(path)
, so we added them. The getX
for numbers was modified so that it does parse a string so if the string is a number "123"
or in the case of float or double "12.3"
. We did this mainly so we could access environment variables easily.
We added these helper functions to the JavaScript config.
JavaScript functions that we support
sysProp(propName)
to read a sysProp as infooSize : sysProp("my.foo.size")
sysPropOrDefault(propName, defaultValue)
to read a sysProp or a defaultisWindowsOS()
,isMacOS()
,isUnix()
,isLinux()
,isSolaris()
env()
as infooSize : env('MY_FOO_SIZE')
or evenfooSize : sysPropOrDefault("my.foo.size", env('MY_FOO_SIZE'))
uri()
which creates ajava.net.URI
as infooURI : uri ("http://localhost:8080/")
java.time.Duration
is imported asduration
java.lang.System
is imported assystem
seconds(units)
,minutes(units)
,hours(units)
,days(units)
,millis(units)
andmilliseconds(units
) define aDuration
which is useful for configuring timeouts and interval jobs
Working with java.lang.Boolean for Java Config.
getBoolean(path)
read a booleangetBooleanList(path)
read a list of booleans
Documented using Konf to define your own DSL
Defining your own config DSL with Konf
You can define you own config DSL for your environment.
We have a full example that shows you how to create a custom config DSL
for your internal projects. The example uses Mesosphere and Docker PORT
look ups and it is from a real project.
Defining your own config DSL
var config = {
platform: {
statsd: "udp://" + getDockerHost() + ":8125",
servicePort: mesosPortAt(0, 8080),
adminPort: mesosPortAt(1, 9090),
...
Using different resources when you load config
config = ConfigLoader.load(
"/io/mycompany/foo-classpath.js",
"classpath:test-config.js",
"classpath://foo.js",
"classpath:/bar.js",
"file://opt/app/config.js",
"file:///opt/app/config2.js",
"file:/opt/app/config.js",
"http://my.internal.server:9090/foo.js"
);
getMemorySize
We now support getMemorySize(path) and getMemorySizeList(path).
/**
* Get a ConfigMemorySize at location
*
* @param path path
* @return string at location.
*/
ConfigMemorySize getMemorySize(String path);
/**
* Get a ConfigMemorySize list at location
*
* @param path path
* @return string at location.
*/
List<ConfigMemorySize > getMemorySizeList(String path);
This means we support config like:
diskSpace : " 10 gigabytes",
diskVolumes : [" 10 gigabytes", "10GB", "10 gigabytes", 10]
Thanks
If you like our configuration project, please try our
Reactive Java project
or our Actor based microservices lib.
Konf Java configuration with JSON, YAML and JavaScript version 1.1.0.RELEASE
Added getDuration(path)
, getIntList(path)
, and the rest of the numbers (double, float, long).
Working with java.time.Duration
getDuration(path)
get a durationgetDurationList(path)
get a duration list
Konf supports "10 seconds" style config for duration as well as
having built-in functions and support for ISO-8601. See documentation
for duration config
for more details.
Konf can reads list of numbers.
getIntList
reads list of intsgetLongList
reads list of longsgetDoubleList
reads list of doublesgetFloatList
reads list of floats
See documentation list of number configuration
for more details.
Thanks
If you like our configuration project, please try our
Reactive Java project
or our Actor based microservices lib.
First release, Konf Java configuration system
First release, Konf Java configuration system.