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

feat: add ConfigService#getOrThrow() #941

Merged
merged 4 commits into from Jun 2, 2022
Merged

feat: add ConfigService#getOrThrow() #941

merged 4 commits into from Jun 2, 2022

Conversation

jonahsnider
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Users must either use full schema validation of configuration values or write their own .getOrThrow() method.

Issue Number: N/A

What is the new behavior?

ConfigService#getOrThrow() can be used to get a configuration value by key, and throw if it does not exist (and no default value was provided).

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Relevant Discord conversation.

lib/config.service.ts Outdated Show resolved Hide resolved
lib/config.service.ts Outdated Show resolved Hide resolved
@kamilmysliwiec
Copy link
Member

Great addition!

@micalevisk
Copy link
Member

@jonahsnider can you rebase your branch? go to your repo and click on Fetch upstream > Fetch and merge

@kamilmysliwiec kamilmysliwiec merged commit 7df0717 into nestjs:master Jun 2, 2022
@kamilmysliwiec
Copy link
Member

LGTM

@jonahsnider jonahsnider deleted the get-or-throw branch June 2, 2022 16:54
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

Successfully merging this pull request may close these issues.

None yet

4 participants