# ConfigMap spec and handler API

URL: /docs/develop/workloads/configuration/spec

Every field of ConfigMap, then the methods a handler calls on ctx.config.

This page lists the spec fields of ConfigMap, each with its type, its limits and its description. The [Platform page](/docs/platform/workloads/configuration.md) explains the concept, and the `metadata` of every kind is [the same](/docs/develop/common-definitions.md#objectmeta).

## ConfigMap [#configmap]

```yaml
apiVersion: funcd.io/v1alpha1
kind: ConfigMap
metadata:
  name: shared-settings
  namespace: default
  resourceGroup: rg1
spec:
  data:
    LOG_LEVEL: info
    TIMEZONE: Europe/Paris
```

| apiVersion | kind |
| --- | --- |
| `funcd.io/v1alpha1` | `ConfigMap` |

### `ConfigMap.spec` [#configmapspec]

| Field | Type and limits | Description |
| --- | --- | --- |
| `data` | map of string to string | Keys and their string values, for settings that are not secret. Each key is an environment variable name: ASCII letters, digits and \_, not starting with a digit. Each value must be UTF-8 text with no NUL byte: a Function or a Lake that binds a ConfigMap holding another value does not start. Each worker of a Function that lists the ConfigMap in bindings.config gets each key as an environment variable when it starts, except a key that starts with FUNCD\_ or that a bound Secret also holds; and while the S3 gateway is on, a Function that binds a Bucket gets the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY that funcd issues it, in place of the ConfigMap's. A Lake that lists it gives its engine only the keys that the Lake's bindings.config lets through. |

## Handler API [#handler-api]

The methods a handler calls on its context's clients, in each language funcd ships a shim for.

### `ctx.config` [#ctxconfig]

#### TypeScript [#typescript]

The keys of the ConfigMaps that the function binds, with the values that the worker got when it started. A key that starts with FUNCD\_ is left out, since funcd reserves that prefix. A key that a bound Secret also holds is left out too, and ctx.secret reads the Secret's value. While funcd's S3 gateway runs, a function that binds a Bucket reads the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY that funcd issues it, in place of a ConfigMap's.

| Method | What it does |
| --- | --- |
| `get(key: string): string \| undefined` | The key's value, or undefined when list() does not include the key. |
| `list(): string[]` | The keys of the bound ConfigMaps, sorted, without the keys left out. |

#### Python [#python]

The keys of the ConfigMaps that the function binds, with the values that the worker got when it started. A key that starts with ``FUNCD_`` is left out, since funcd reserves that prefix. A key that a bound Secret also holds is left out too, and ``ctx.secret`` reads the Secret's value. While funcd's S3 gateway runs, a function that binds a Bucket reads the ``AWS_ACCESS_KEY_ID`` and ``AWS_SECRET_ACCESS_KEY`` that funcd issues it, in place of a ConfigMap's.

| Method | What it does |
| --- | --- |
| `get(key: str) -> str \| None` | The key's value, or ``None`` when ``list()`` does not include the key. |
| `list() -> list[str]` | The keys of the bound ConfigMaps, sorted, without the keys left out. |

## HTTP API [#http-api]

The table lists each described operation of these kinds, with its method and path. The operation's page in the API reference gives its parameters, its body, its authentication and every answer, with when it happens and what to do.

| Method | Path | Operation |
| --- | --- | --- |
| `GET` | `/apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps` | [List the ConfigMaps of a namespace](/docs/api/workloads/configmap/list.md) |
| `POST` | `/apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps` | [Create a ConfigMap](/docs/api/workloads/configmap/create.md) |
| `GET` | `/apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps/{name}` | [Read a ConfigMap](/docs/api/workloads/configmap/get.md) |
| `PUT` | `/apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps/{name}` | [Replace a ConfigMap](/docs/api/workloads/configmap/replace.md) |
| `DELETE` | `/apis/funcd.io/v1alpha1/namespaces/{namespace}/configmaps/{name}` | [Delete a ConfigMap](/docs/api/workloads/configmap/delete.md) |
