Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for internal store and namespaces. #7

Open
nodech opened this issue Apr 4, 2022 · 0 comments
Open

Proposal for internal store and namespaces. #7

nodech opened this issue Apr 4, 2022 · 0 comments

Comments

@nodech
Copy link
Member

nodech commented Apr 4, 2022

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 (Allow for multiple layered config files #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`.
  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant