Commit Graph

109 Commits

Author SHA1 Message Date
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
6ec2681055 missing, optional substitutions ${?foo} become undefined not null
This is more useful behavior because it permits an optional override
for example.
2011-11-27 12:04:44 -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
afff7c61ef Explain in README how to take advantage of substitutions 2011-11-22 10:53:35 -05:00
Havoc Pennington
13362f46b4 fix the example API usage in the README 2011-11-18 17:49:40 -05:00
Havoc Pennington
ece196c146 mention foo.bar=10, foo.baz=12 style syntax (single line properties-style) 2011-11-15 23:35:24 -05:00
Havoc Pennington
1841dd9c67 Add a real README, license, and rewrite spec. 2011-11-15 19:14:22 -05:00
Havoc Pennington
00241585bd add an empty README.md 2011-11-10 20:54:53 -05:00