
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@stefanoruth/env
Advanced tools
[](https://github.com/stefanoruth/env/actions/workflows/build.yml)
A typescript env parser, that validates server configuration and works well integration with libraries such as dotenv
yarn add @stefanoruth/env
import { envParser } from '@stefanoruth/env'
const config = envParser({
port: { type: 'number', defaultValue: 3000, env: 'PORT' },
domain: { type: 'string', env: 'DOMAIN' },
secret: { type: 'string', env: 'JWT_SECRET', optional: true },
mode: { type: 'const', options: ['development', 'production'] as const, env: 'NODE_ENV' },
})
config.port // number
config.domain // string
config.secret // string | undefined
config.mode // 'development' | 'production'
Supported types
Type | Notes |
---|---|
number | |
string | |
boolean | |
const | Const takes in an array of allowed values, the system with throw errors if the value from runtime or default value has not been set, (Note the return will be strict if you cast the array as const else, the array will be treated as an array of strings) |
Each type has a the options:
Option | Description |
---|---|
env | Determines which key should be used when extracting the value from process.env |
optional | If a value is not marked as optional the system will automaticly throw an error when being called |
defaultValue | Each type has a default value that relates to the chosen type |
FAQs
[](https://github.com/stefanoruth/env/actions/workflows/build.yml)
We found that @stefanoruth/env demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.