Commit Graph

235 Commits

Author SHA1 Message Date
Havoc Pennington
0c55fd6f06 note that ${} is special in HOCON and not in Java properties 2011-12-06 00:20:21 -05:00
Havoc Pennington
f95c309462 add a couple of minor notes to the README about sbt and Java properties 2011-12-06 00:12:44 -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
6bba70d13c Make tokenizer create a Problem token instead of throwing parse errors
This allows the parser to throw the error. The parser can add more
context such as the name of the key whose value is being parsed.
2011-12-05 21:54:31 -05:00
Havoc Pennington
38b835d966 correct README statement that include "application" won't work from a file
An earlier change made includes in files fall back to classpath.
2011-12-05 14:46:41 -05:00
Havoc Pennington
8e3f56cd82 0.1.5-SNAPSHOT 2011-12-05 14:27:24 -05:00
Havoc Pennington
69e28a8542 0.1.5 2011-12-05 14:27:09 -05:00
Havoc Pennington
6254a1bccd improve error messages for reserved chars
Requires passing the char through the tokenizer to the parser
since the parser will have more contextual information to
include in the error.
2011-12-05 14:25:22 -05:00
Havoc Pennington
236a49fe3e put back -SNAPSHOT for git 2011-12-05 13:23:18 -05:00
Havoc Pennington
d5b79c00b4 0.1.4 2011-12-05 13:23:06 -05:00
Havoc Pennington
005cd6da2c Improve error messages to suggest quoting strings or using .properties
Also, when displaying a token use a more user-friendly format
like ',' instead of COMMA
2011-12-05 13:22:05 -05:00
Havoc Pennington
63b920acd1 add a short summary of the Examples 2011-12-04 20:51:24 -05:00
Havoc Pennington
1e1785cb75 switch version back to -SNAPSHOT post-release 2011-12-02 21:48:55 -05:00
Havoc Pennington
27980ab82c 0.1.3 and move to the proper publish url (maven- not ivy-) 2011-12-02 21:48:29 -05:00
Havoc Pennington
c7f6428ccb back to -SNAPSHOT 2011-12-02 19:28:20 -05:00
Havoc Pennington
f2c96c6943 bump to 0.1.2 2011-12-02 19:21:13 -05:00
Havoc Pennington
23280e8c49 Publish 0.1.1 snapshot 2011-12-02 18:45:34 -05:00
Havoc Pennington
f6fd02508e add Config.entrySet() which returns the set of paths and non-null values 2011-12-02 18:44:11 -05:00
Havoc Pennington
38fb8d6834 move publish settings to config/ project instead of global 2011-11-30 16:35:41 -05:00
Havoc Pennington
2365db970e Get the build ready for publishing releases
Not sure this is quite right, but closer than before.
2011-11-30 16:30:03 -05:00
Havoc Pennington
0ff5f1ff8c README code example fix 2011-11-30 11:18:46 -05:00
Havoc Pennington
2abd5ad09c minor README tweaks 2011-11-30 10:52:01 -05:00
Havoc Pennington
6d8e476dcf remove two "future directions" from the README
I don't think they made sense:

- "fallback lists" in substitutions can already be done another way
- the "delete" operator isn't clearly useful and feels imperative
  rather than declarative
2011-11-30 10:44:47 -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
5cc18bdc03 handle file: URLs the same as files; support including absolute filenames 2011-11-30 09:43:11 -05:00
Havoc Pennington
9689abd781 make ConfigException abstract 2011-11-30 09:24:46 -05:00
Havoc Pennington
9f9b351f0e add some more javadoc to ConfigException.java 2011-11-30 09:15:49 -05:00
Havoc Pennington
4896b7d75d When using "singleton holder" catch ExceptionInInitializerError and pull out the ConfigException if any 2011-11-30 09:01:48 -05:00
Havoc Pennington
62628b6404 some README cleanups 2011-11-30 01:55:56 -05:00
Havoc Pennington
9b44709c89 support -Dconfig.resource, -Dconfig.file, -Dconfig.url system props
These override application.{conf,json,properties} for ConfigFactory.load()
2011-11-30 01:51:36 -05:00
Havoc Pennington
a3988e9b03 improve path rendering to avoid quoting hyphenated keys like foo-bar 2011-11-29 20:51:57 -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
ad6fd0f156 add more tests for substitution behavior in included files 2011-11-29 15:39:27 -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
baa126633a Move ConfigMergeable.toValue to be private, as MergeableValue.toFallbackValue
Avoids confusion because ConfigValue.toValue was pointless and
Config.toValue was not as clear as Config.root (plus having two ways
to do it on Config was strange).

This change does require a cast in the withFallback implementation but
we already have the analogous pattern all over the place (i.e. assuming that
instances of the public interfaces are always instances of our private
implementations).
2011-11-29 14:30:33 -05:00
Havoc Pennington
b50ed75f92 add missing "final" to SimpleConfig, was an oversight 2011-11-29 12:11:39 -05:00
Havoc Pennington
444219bb17 Optimize no-op object merges by throwing away the new HashMap and using the old one
One side effect of this is that if an object merge does nothing, the ConfigOrigin
for the fallback is discarded instead of merged in, but I think that's OK.
2011-11-29 10:02:26 -05:00
Havoc Pennington
4964fdcbf0 In the examples, also show using the config for the app itself 2011-11-29 09:09:50 -05:00
Havoc Pennington
9af5a67d6c fix api doc note about setUseSystemProperties doing nothing
This is a mess, I earlier added a note to the README about needing
to fix it.
2011-11-29 08:56:25 -05:00
Havoc Pennington
a840c2599d Rename getMemorySizeInBytesList to getBytesList to match getBytes 2011-11-29 08:44:07 -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
00a19f3f5d fix a typo in a comment in simple-lib 2011-11-28 12:52:44 -05:00
Havoc Pennington
130544f98a fix simple-lib to call checkValid() specifying a path. 2011-11-28 12:52:13 -05:00
Havoc Pennington
cfb4887d50 use a cached singleton for ConfigFactory.load() 2011-11-28 12:46:11 -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
e6ee3d6232 mention using several env vars for one setting in README 2011-11-28 01:37:29 -05:00
Havoc Pennington
789930cd8e Implement Config.checkValid() to check against a reference config
This allows verifying that a config has all the keys it's supposed
to have, and also that they have plausible value types. It uses
a reference config as a kind of very loose schema.

Another benefit is that it can give users a big batch of error
messages at once, rather than one at a time via exceptions
when config settings are used.

Because the reference config is not really a schema, users of
checkValid() may have to tune its behavior by removing some
things from the reference config used for validation, or
ignoring certain errors, or doing additional validation
on their own. But checkValid() is a good basic validator
for all your simple settings and if you have complex
settings you can write additional code to support them
while still using checkValid() for the simple ones.
2011-11-28 01:14:31 -05:00
Havoc Pennington
6692dba893 make SimpleConfigList.get return an AbstractConfigValue
preserve the detailed type that we know for the subclass
2011-11-28 01:13:18 -05:00