Commit Graph

19 Commits

Author SHA1 Message Date
Havoc Pennington
9cf554250b add a note to the spec contrasting with Java properties syntax 2011-12-06 00:12:21 -05:00
Havoc Pennington
0c200aad93 fix markup of one of the bullet lists in the spec 2011-12-05 23:51:48 -05:00
Havoc Pennington
99739bead3 specify that file: URLs must work just like filenames 2011-12-05 23:51:15 -05:00
Havoc Pennington
9578a79538 Better handle includes for files and classpaths
- support "/" to get an absolute file or resource
- fall back to a resource if there's no file
2011-11-30 10:35:21 -05:00
Havoc Pennington
81ce6038c7 remove special-case fallback to system props in substitutions.
The earlier change to make ${user.home} in a file included underneath
"foo" search both ${foo.user.home} and then ${user.home}, means
that even in included files system props are picked up just fine
as long as they were merged into the root config. So there is no
longer any need to have a special-case fallback to system properties.

This leaves ConfigResolveOptions as a really complex way to pass
in a single bool, but of course the point is to allow for future
extension.
2011-11-29 15:46:55 -05:00
Havoc Pennington
53193a48d3 Search for substitutions both included-file-relative and root-relative
This should lay the groundwork for removing the special case fallback
to system properties, and allows included files to look at the reference
configuration.
2011-11-29 15:21:13 -05:00
Havoc Pennington
4f3a91fd86 document why substitutions special-case system props
currently needed for files that are included in other files.

not really happy with how this works now, but documenting it
as a starting point.

maybe to force a substitution to resolve from the root we could
start it with a period? ${.this.is.a.root.prop} ?
2011-11-28 15:11:26 -05:00
Havoc Pennington
9aae9e2a80 Overhaul ConfigFactory API and ConfigFactory.load().
Update all docs and tests.

Add example library and application.
2011-11-28 12:23:21 -05:00
Havoc Pennington
0457e352fb correct spec's text about empty environment variables 2011-11-27 12:06:10 -05:00
Havoc Pennington
4dddfdaf19 Make ${missing} throw an exception and add ${?missing} for the old behavior.
Also updated the spec; in this patch, the spec says ${?missing} will be
undefined, but the code still evaluates it to null as in the old
behavior. A follow-up patch will introduce the undefined behavior
that is now specified.

This change is needed because missing substitutions are probably
a problem in most cases, and evaluating missing to null is probably
not as useful as evaluating it to undefined. If it turns out that
we need the null behavior, a possible syntax is ${foo.bar,null}
or something like that.
2011-11-27 11:33:10 -05:00
Havoc Pennington
00f8b3d507 Prohibit additional chars in unquoted strings.
The general idea here is to permit future syntax extensions;
as a rule, new syntax can only be added by using one of these
characters that can't be a string.

Backtick ` in particular is in the current ECMAScript drafts
for multiline strings, so supporting multiline strings with
that would be a very natural thing to do.

The other characters added here (^, !, ?, @, *, &) are
more or less arbitrary. &, ! and * have special meaning
in YAML so might be natural ones to use for similar
purposes. ? would have some natural "let this be missing"
meaning, @ is often used in template-like things, and ^
could be used for some unforeseen need.
2011-11-25 12:13:38 -05:00
Havoc Pennington
515a71ba66 Change getMemorySizeInBytes to getBytes and support mebi/gibi/etc. 2011-11-25 11:56:59 -05:00
Havoc Pennington
4619d05cd2 minor tweaks to explanation of classpath includes 2011-11-21 09:10:06 -05:00
Havoc Pennington
817bbb73eb prohibit control characters in quoted strings per JSON spec 2011-11-17 00:44:19 -05:00
Havoc Pennington
0bb9d19727 test "10.0foo" path expression, and correct the spec
The spec described parsing this as a 1-element path but
the implementation parsed it as 2 elements which is probably
a better behavior because it's less surprising. The simple
rule is now "only quoted periods are special".
2011-11-16 23:23:46 -05:00
Havoc Pennington
9dc6f77078 Fix behavior when merging object,primitive,object.
The AbstractConfigObject.merge() method was wrong; it merged in the
wrong order, which produced incorrect results. But there was a test
verifying that the results were wrong! So it's OK right?
Anyway, fix the test, fix the code, be sure it's crystal clear in spec.
2011-11-16 22:07:14 -05:00
Havoc Pennington
3610dc8d76 support "/" in unquoted strings (and therefore keys) 2011-11-16 11:03:16 -05:00
Havoc Pennington
20b75542e4 support "on" and "off" when converting string to boolean 2011-11-16 10:34:40 -05:00
Havoc Pennington
1841dd9c67 Add a real README, license, and rewrite spec. 2011-11-15 19:14:22 -05:00