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

[V2] Replace Config.get with Config.get2 #732

Merged
merged 9 commits into from
May 29, 2020
Merged

[V2] Replace Config.get with Config.get2 #732

merged 9 commits into from
May 29, 2020

Conversation

LoicPoullain
Copy link
Member

@LoicPoullain LoicPoullain commented May 28, 2020

Issue

Current Config.get function has several faults (#496).

In version 2, Config.get is replaced with Config.get2.

Solution and steps

  • Replace all mentions of Config.get with Config.get2.
  • Remove ConfigMock
  • Remove Config as a service.
  • Remove Config.get
  • Rename Config.get2 to Config.get

How to upgrade (to include in v2 release)

// Version 1 
const foo = Config.get('settings.foo');
const foo = Config.get('settings.foo', 'hello');
const port = Config.get<number>('settings.port', 3000);
const port = Config.get<number>('settings.port');
const foobar = Config.get<boolean|string>('foobar');

// Version 2
const foo = Config.get('settings.foo'); // Same
const foo = Config.get('settings.foo', 'any', 'hello');
const port = Config.get('settings.port', 'number', 3000);
const port = Config.getOrThrow('settings.port', 'number')
const foobar = Config.get('foobar', 'boolean|string');

ConfigMock as been removed and Config cannot be used as a service anymore. Use the static method Config.get instead.

Checklist

  • Add/update/check docs (code comments and docs/ folder).
  • Add/update/check tests.
  • Update/check the cli generators.

@LoicPoullain LoicPoullain merged commit f701e12 into v2-0-0 May 29, 2020
Issue tracking automation moved this from Work In Progress to Done / Closed This Release May 29, 2020
@LoicPoullain LoicPoullain deleted the config-get2 branch May 29, 2020 06:27
@LoicPoullain LoicPoullain mentioned this pull request May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Issue tracking
  
Done / Closed This Release
Development

Successfully merging this pull request may close these issues.

None yet

1 participant