Commit Graph

49 Commits

Author SHA1 Message Date
matsu-chara
74a5edfab5 fix broken link in hocon.md 2017-03-02 15:45:35 +09:00
John Lonergan
f687a8fea3 implemented "required include" along with code review comments from previous attempt at pull request 2016-08-27 03:58:44 +01:00
Havoc Pennington
79fc367685 Update doctoc for README.md and add doctoc to HOCON.md 2015-03-07 16:41:02 -05:00
Havoc Pennington
8c310ef5e8 Test and document current behavior of file() includes
At present, we don't make a file() include relative to the
file doing the including. This is discussed in #202.
We should most likely change this behavior, but this
commit documents and tests it.
2015-03-06 21:34:35 -05:00
Havoc Pennington
2df7b6b419 Allow unquoted whitespace between substitutions that expand to objects/lists
Fixes #212 that object and list substitutions could not have
whitespace in between.

This patch carries quoted-ness into ConfigString, which is somewhat
bogus, and we may be able to clean it up later if we start to track
the tokens that each value originates from.
2015-03-02 16:11:51 -05:00
Havoc Pennington
1afaea55a8 Merge remote-tracking branch 'origin/master' into wip/havocp-resolve-fixes
Conflicts:
	config/src/main/java/com/typesafe/config/impl/SimpleConfigList.java
2014-12-27 16:45:44 -05:00
Havoc Pennington
197be59fec Merge pull request #173 from typesafehub/wip/havocp-out-of-range-bytes
Throw an exception if size-in-bytes values are out of Long range
2014-12-27 13:43:51 -08:00
Havoc Pennington
6c96f2eaa3 Merge pull request #184 from alexwei/master
Added missing duration unit short names that are supported in scala and more
2014-12-27 13:34:11 -08:00
Havoc Pennington
f3ec3aa910 Missing backtick in HOCON.md
Reported by @takc923
2014-11-11 14:49:47 -05:00
Havoc Pennington
da494cd8a0 Spec: must memoize when resolving substitutions 2014-10-22 13:59:06 -04:00
Alex Wei
b76b406f2b Patch spec with duration units from Scala that were previously missing. 2014-08-11 18:36:14 +10:00
Havoc Pennington
6311ef8d4d Throw an exception if size-in-bytes values are out of Long range
Fixes #170
2014-06-23 12:13:40 -04:00
Havoc Pennington
08c4fe3950 If all concatenation elements are undefined, undefine the field
This is a spec change but the spec was wrong and the implementation
previously just threw an exception.

The spec claimed that ${?foo}${?bar} would become empty string,
but it's more useful for it to just become undefined.
You can add an explicit empty string with "" if you want it
to be empty string.

Fixes #161.
2014-05-05 11:02:49 -04:00
Havoc Pennington
e61a677f58 Fix a broken example in the spec
3.14 as a key is "3" : { "14"
2014-01-07 15:13:45 -05:00
Havoc Pennington
7ac81ecb5e Allow unquoted strings consisting entirely of number chars
Previously, a string which was an invalid number (such as
"1.0.0" or "1e3e3") but consisted entirely of chars allowed
in numbers would be an error and require quoting. Now, we
allow such strings to be unquoted.
2013-12-06 12:24:17 -05:00
Havoc Pennington
868a50a53d Try to use Content-Type when loading a URL
This is intended to fix #67. Unfortunately we don't have test coverage
for URL loading, so not feeling super confident.
2013-09-27 13:27:39 -04:00
Havoc Pennington
7231e14886 Treat BOM as whitespace, fixes #75 2013-06-21 10:59:38 -04:00
Havoc Pennington
61675293f7 Discuss conversion of objects to arrays in the spec 2013-05-09 12:17:29 -04:00
Havoc Pennington
b9a8af5960 add a colon in the spec 2012-10-02 09:20:37 -04:00
Havoc Pennington
e1d5bc7506 Implement triple-quoted multiline strings
Details are in the spec/news/readme changes in the patch.
2012-06-18 23:01:43 -04:00
Havoc Pennington
445a700c53 add notes on Akka 2.0 embedded config limitations to HOCON.md
These were already in the README but people may jump straight
to the spec, so add them there too.
2012-05-14 12:02:35 -04:00
Havoc Pennington
8c6b204905 Specify url() classpath() file() includes in the spec 2012-04-09 10:28:45 -04:00
Havoc Pennington
69e6164b30 Support += convenience syntax
a += b

transforms to

    a += ${?a} [b]
2012-04-06 10:58:00 -04:00
Havoc Pennington
27096e262f Minor spec editing 2012-04-06 00:52:53 -04:00
Havoc Pennington
47e168a92f Implement array and object concatenation
path : [ /bin ]
  path : ${path} [ /usr/bin ]

This added very few lines of code or bytecode!
It's just a natural extension of the existing
string concatenation.

But it did add a fair few lines of specification
and tests.
2012-04-06 00:35:47 -04:00
Havoc Pennington
a8d444e19f Improve the spec's description of self-referential semantics 2012-04-05 14:59:05 -04:00
Havoc Pennington
44ce684985 Allow self-referential fields.
With this patch, you can write:

    path="a🅱️c"
    path=${path}":d"

The semantics are somewhat complicated to specify and
implement, but hopefully not complicated to use for
any reasonable usage that makes any sense.

This patch is technically backward incompatible,
illustrated by a change to existing unit tests,
but the changed behavior is in a bizarre corner case:
cyclical self-references where the cycle could be broken
by only partially resolving an object.

This corner case just threw an exception in the version
of this lib included with Akka/Play 2.0, but in commit
a59e31f744 we tried to handle the case. So the behavior
changes since that commit.

The partial resolution case now has the same consistent
defined semantics we use for all self-reference
resolution, that is it "looks back." In the previous
code it would "look forward."
2012-03-29 14:25:28 -04:00
Havoc Pennington
f497419970 minor clarifications and typo fixes in the spec 2012-03-01 19:47:14 -05:00
Havoc Pennington
bda507b474 Fix behavior of ${?} optional substitution overriding a field
The broken behavior was:
  foo=10
  foo=${?bar}
where 'foo' should be 10 if bar is undefined, but instead
ended up undefined. Now, foo will be 10 (which was the
documented behavior).
2012-01-20 18:37:07 -05:00
Havoc Pennington
0c55fd6f06 note that ${} is special in HOCON and not in Java properties 2011-12-06 00:20:21 -05:00
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