---
title: ConfigStore
summary: Class for accessing a Fastly Config Store.
url: https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/config-store/class.ConfigStore/
---

**Kind:** Class  
**Module:** [config-store](https://www.fastly.com/documentation/reference/compute/sdks/javascript/js-compute/config-store/)  
**Package:** @fastly/js-compute 4.0.1  
**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/config-store.d.ts#L18

Class for accessing a [Fastly Config Store](https://www.fastly.com/documentation/reference/api/services/resources/config-store/).

**Note**: Can only be used when processing requests, not during build-time initialization.

```js
import { ConfigStore } from "fastly:config-store";

async function app(event) {
  const config = new ConfigStore("animals");
  return new Response(config.get("cat"));
}
addEventListener("fetch", (event) => event.respondWith(app(event)));
```

## Constructor

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/config-store.d.ts#L29

```javascript
new ConfigStore(name: string)
```

Creates a new ConfigStore object, providing access to the named
[Config Store resource](https://www.fastly.com/documentation/reference/api/services/resources/config-store/).

**Parameters**

- `name`: `string` — The resource link name for the Config Store.

**Throws**

- `TypeError` if no Config Store exists with the provided name.
- `TypeError` if the provided name is empty, longer than 255 characters,
  does not start with an ASCII alphabetical character, or contains characters
  other than ASCII alphanumerics, underscores, and spaces.

## Methods

### get

**Source:** https://github.com/fastly/js-compute-runtime/blob/70cf30af4e657879b2d1e7eafab880e39e3a3f7d/types/config-store.d.ts#L37

```javascript
get(key: string): string | null
```

Get a value for a key in the Config Store. If the provided key does not
exist in the Config Store then this returns `null`.

**Parameters**

- `key`: `string` — The key to retrieve.

**Returns**

`string | null`

**Throws**

- `TypeError` if the provided key is empty or longer than 255 characters.
