# config

Read the project's variables and secrets.

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

```python
from wisp import config
```

Variables and secrets are read the same way. See [Variables and secrets](/variables-and-secrets).

## config.get(name, fallback?)

Returns the value as a string, or `fallback` (default `undefined` / `None`) when it isn't set.

```js
const base = config.get('API_BASE', 'https://api.example.com');
```

## config.require(name)

Returns the value, or throws a `WispError` that names the missing setting.

```python
key = config.require("OPENAI_API_KEY")
```

Use `get` and return your own error when you want a friendlier response:

```js
const key = config.get('OPENAI_API_KEY');
if (!key) return { status: 500, body: { error: 'OPENAI_API_KEY is not set' } };
```

## config.has(name)

`true` when the setting exists.

## config.names()

The names of all variables and secrets of the project.
