# Variables and secrets

Store configuration and credentials outside your code. Read them with config.get in JavaScript or Python.

**Config** has two lists:

- **Variables** — settings that aren't sensitive, such as a base URL, a currency or a feature flag.
- **Secrets** — API keys, tokens and passwords. Values are encrypted, hidden after you save them and never shown to the assistant.

Names are `UPPER_SNAKE_CASE`.

## Read them in code

```js
import { config } from 'wisp';

const key = config.require('STRIPE_SECRET_KEY'); // throws a clear error if missing
const currency = config.get('CURRENCY', 'usd');   // with a fallback
```

```python
from wisp import config

key = config.require("STRIPE_SECRET_KEY")
currency = config.get("CURRENCY", "usd")
```

Both are also available as environment variables, but the SDK gives clearer errors. See the [config reference](/api/sdk-config).

## Add a value

- **In the console:** open **Config → Variables** or **Config → Secrets** and press **New**.
- **When the assistant asks:** if code needs a credential that isn't set, the assistant shows a secure form. The value goes straight to encrypted storage.
- **From the CLI:** `wisp config set STRIPE_SECRET_KEY sk_live_... --secret`.

Changes apply to the draft and the live version immediately — no publish needed.

> [!WARNING]
> Never hard-code credentials in your code. Code is visible to everyone with access to the project, stored in version history and synced to GitHub if you connect it.

## Delete a value

Delete it from the list, with `wisp config rm NAME`, or ask the assistant. Code that requires it will return an error naming the missing setting.
