You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of the time, empty string is not a valid configuration, it often comes from a .env file not filled in by the user (file that comes from .env.example or something)
# Redirect the emails to this userEMAIL_REDIRECT=DB_URL=
I believe this case is common enough to be a part of the Effect repo.
What is the feature you are proposing to solve the problem?
Add a new constructor:
constdbUrl=yield*Config.stringNonEmpty("DB_URL");
What alternatives have you considered?
Making my own function like the one @tim-smart did:
import{Config,ConfigError,Either,Redacted}from"effect"exportconstnonEmptyString=(name: string)=>Config.string(name).pipe(Config.mapOrFail(_=>{consttrimmed=_.trim()returntrimmed!==""
? Either.right(trimmed)
: Either.left(ConfigError.MissingData([],"must not be empty"))}),)
The text was updated successfully, but these errors were encountered:
What is the problem this feature would solve?
Most of the time, empty string is not a valid configuration, it often comes from a .env file not filled in by the user (file that comes from .env.example or something)
Some other packages (like https://env.t3.gg/docs/core) have an option to treat empty string as undefined.
I believe this case is common enough to be a part of the Effect repo.
What is the feature you are proposing to solve the problem?
Add a new constructor:
What alternatives have you considered?
Making my own function like the one @tim-smart did:
The text was updated successfully, but these errors were encountered: