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

Implement graceful-config #1

Merged
merged 15 commits into from
Aug 6, 2020
Merged

Implement graceful-config #1

merged 15 commits into from
Aug 6, 2020

Conversation

yidafu
Copy link
Collaborator

@yidafu yidafu commented Aug 4, 2020

Usage

Read config.{default|NODE_ENV}.{js|json} in specific directory,

const config = new GracefulConfig({
  path: './config/',
  prefix: 'matrix',
});

const value = config.getConfig('foo[0][1].bar[1]');

// all config value has been freezen, you can't modify any config values
value.baz = 'modify'; // doesn't work

Merge 2 GracefulConfig Instance.

const config1 = new GracefulConfig({
  path: './path/to/dir-1/config/',
  prefix: 'matrix',
});

const config2 = new GracefulConfig({
  path: './path/to/dir-2/config/',
  prefix: 'matrix',
});

config1.merge(config2)

Learn more about usage, pleace see test/ directory.

@kk0829 kk0829 merged commit f09b9ea into master Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants