-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made
Config.redacted
more general (#3873)
Co-authored-by: maksim.khramtsov <maksim.khramtsov@btsdigital.kz>
- Loading branch information
Showing
4 changed files
with
48 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
"effect": minor | ||
--- | ||
|
||
`Config.redacted` has been made more flexible and can now wrap any other config. This allows to transform or validate config values before it’s hidden. | ||
|
||
```ts | ||
import { Config } from "effect" | ||
|
||
Effect.gen(function* () { | ||
// can be any string including empty | ||
const pass1 = yield* Config.redacted("PASSWORD") | ||
// ^? Redacted<string> | ||
|
||
// can't be empty string | ||
const pass2 = yield* Config.redacted(Config.nonEmptyString("PASSWORD")) | ||
// ^? Redacted<string> | ||
|
||
const pass2 = yield* Config.redacted(Config.number("SECRET_NUMBER")) | ||
// ^? Redacted<number> | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters