Bconfig updates
Table of Contents
Bconfig updates
There are several issues that have accumulated, so I will try to sum up
desired behaviour for the bcfg.
- Use
camelCase
to represent namespaces internally. Currently it only
lower cases everything.
- remove special configuration type:
config
, that just overrides
whatever is passed to getFile
. This will remove inconsistency with Config
option and multiple files update (#3).
- Files, Env, Args, Hash and Query should translate to
camelCase
for
internal representation(1).
- Options injected from javascript can pass
camelCase
to pass the
options(1).
- Module names can use
-
(dash) to have multi word names.
(e.g. log-network
)
- filter will use dash separated (
dash-case
) prefix, instead
of ignoring case.
Parsing
File
Format of the file does not change. The thing that changes is how we
process the results.
Example:
option-example: 123
optionexample: 111
Current behaviour wont differentiate between these two. It will be
optionexample
internally. These will be two different options with new
behaviour: optionExample
and optionexample
.
Env
Similar problem:
MODULE_OPTION_EXAMPLE=123
MODULE_OPTIONEXAMPLE=111
will be: optionexample
internally. New behaviour optionExample
and
optionexample
.
Args
Similar.
--option-example=123 --optionexample=123
This will be: optionexample
internally. New behaviour: optionExample
and
optionexample
.
Injected options
Injected options have the similar behaviour.
config.inject({
optionExample: 123,
optionexample: 111
});
New behaviour will leave them as is, separate. (options
being the namespace
)
Hashes and Query (browser)
query: https://..something/something?exampleOption=123&exampleoption=111
hash: https://..something/something#exampleOption=123&exampleoption=111
These will also generate two separate internal options.
Getting
Getting configurations will still be the same, but will query keys with new
behaviour.
config.str('example-option');
config.str('exampleoption');
Now these will query two different options: optionExample
and optionexample
.
Filtering
Filtering will now use case information as namespace.
// Configuration with `optionExample` and `optionexample`.
const nconfig = config.filter('option');
// will only have `example` from the `optionExample`.