Inject
import { inject } from "@envlet/sdk";
await inject();
const stripe = new Stripe(process.env.STRIPE_KEY);Load
import { load } from "@envlet/sdk";
const values = await load();
const db = connect(values.DATABASE_URL);Get
import { get } from "@envlet/sdk";
const stripeKey = await get("STRIPE_KEY");Install
npm install @envlet/sdkSet up
- 01
Install
npm install @envlet/sdk.
- 02
Set one secret
ENVLET_TOKEN on the host. It is the only secret the host keeps.
- 03
Inject at boot
Call inject() before anything reads process.env.
Questions
- Will my app start if Envlet is down?
- No, and that is the point. The SDK retries for a few seconds, then fails so you notice. It never starts your app with half an environment.
- What does the host need?
- One variable, ENVLET_TOKEN. Everything else arrives at boot.
- Can I still set some values on the Node.js host?
- Yes. A value the host already set wins. Pass override if you want Envlet to win instead.