> ## Documentation Index
> Fetch the complete documentation index at: https://docs.energy.nlead.ch/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> All environment variables the service reads

Configuration is loaded from environment variables (and an optional `.env`
file) via pydantic-settings — see `src/scheduling_bridge/config.py`.

## Market setup

| Variable               | Default  | Meaning                                                                                           |
| ---------------------- | -------- | ------------------------------------------------------------------------------------------------- |
| `HOME_CONTROL_AREA`    | `TenneT` | Control area whose balancing group receives the EPEX/ECC delivery                                 |
| `ACTIVE_CONTROL_AREAS` | all four | Comma-separated subset, e.g. `TenneT,Amprion`                                                     |
| `INCLUDE_EXCHANGE_LEG` | `true`   | Include the EPEX/ECC leg in the Engrate submission (`false` if ECC auto-nominates)                |
| `UNIT`                 | `MW`     | Input unit: `MW` (average per 15 min) or `MWH`. Engrate always receives MWh; MW is converted (÷4) |

<Warning>
  `HOME_CONTROL_AREA` defaults to `TenneT` as a placeholder. Set it to the
  real home area before any live use — it decides where the physical EPEX
  delivery lands.
</Warning>

## Engrate

| Variable                    | Default                  | Meaning                                                                                                |
| --------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------ |
| `ENGRATE_BASE_URL`          | `https://api.engrate.io` | Engrate API base URL                                                                                   |
| `ENGRATE_API_KEY`           | —                        | API key from the [Engrate console](https://console.engrate.io), sent raw in the `authorization` header |
| `ENGRATE_TEST_MODE`         | `false`                  | Sets Engrate's `test` flag: skips gate-closure validation                                              |
| `AREA_MARKET_IDS`           | see below                | JSON: per-area market identifiers                                                                      |
| `EXCHANGE_COUNTERPARTY_EIC` | unset                    | Party EIC of the ECC counterparty for the exchange leg                                                 |

`AREA_MARKET_IDS` maps each control area to its identifiers:

```json theme={null}
{
  "TenneT": {
    "balancing_group_eic": "<EIC of our TenneT balancing group>",
    "control_area_eic": "10YDE-EON------1",
    "tso": "TENNET_DE_TSO",
    "receiver_eic": "10XDE-EON------1"
  }
}
```

The control-area EIC Y codes default to the public, stable values. The
balancing-group EICs default to **placeholders and must be configured**;
the TSO identifiers and receiver EICs follow Engrate's documented pattern
and need verification — see [Assumptions](/setup/assumptions).

## Trader sFTP

| Variable                  | Default   | Meaning                                  |
| ------------------------- | --------- | ---------------------------------------- |
| `SFTP_HOST` / `SFTP_PORT` | — / `22`  | Trader's sFTP server                     |
| `SFTP_USERNAME`           | —         | Login user                               |
| `SFTP_PASSWORD`           | unset     | Password auth                            |
| `SFTP_PRIVATE_KEY_PATH`   | unset     | Key-file auth (alternative to password)  |
| `SFTP_TARGET_DIR`         | `/upload` | Drop directory for the open-position CSV |

## Inbound API scopes and audit

| Variable           | Default      | Meaning                                                          |
| ------------------ | ------------ | ---------------------------------------------------------------- |
| `EXTERNAL_API_KEY` | unset        | The customer's key — grants `POST /v1/forecasts` only            |
| `PROCESS_API_KEY`  | unset        | Internal key — grants the `/v1/process/*` endpoints (and ingest) |
| `AUDIT_DIR`        | `data/audit` | Root directory of the [audit trail](/setup/audit-trail)          |

If **no** key is configured at all, the API is open — local development
only.

<Note>
  In the Azure deployment all of these are wired up by the Bicep template —
  secrets as Container Apps secrets, the audit directory on an Azure Files
  mount, and the orchestrator timer with the process key. See
  [Azure deployment](/setup/azure-deployment).
</Note>
