-
Notifications
You must be signed in to change notification settings - Fork 8
Release Notes Draft
You can also specify the sizes with built-in functions if you don't want to use strings.
diskVolumes: [kilobytes(10), megabytes(10), bytes(10), gigabytes(10)]
import static io.advantageous.config.ConfigLoader.*;
...
private Config config;
...
config = configs(config("test-config.js"), config("reference.js"));
You can load config. The config
method is an alias for load(resources...)
.
The configs(config...)
creates a series of configs where the configs
are search from left to right. The first config that has the object (starting
from the left or 0 index) will return the object.
Give the following two configs (from the above example).
var config = {
abc : "abc",
var config = {
abc : "abcFallback",
def : "def"
}
You could run this test.
final String value = config.getString("abc");
assertEquals("abc", value);
final String value1 = config.getString("def");
assertEquals("def", value1);
You can load your config anyway you like. The String abc
is found
when looking up the key abc
because it is in the test-config.js
which
gets read before the value abcFallback
which is in reference.js
.
Yet the def
key yields the "def"
because it is defined in reference.js
but not test-config.js
. You can implement the same style config reading and
fallback as is in Type Safe Config but with your DSL.