# Environment variables

lib-factory reads these from `process.env`. The factory's `src/index.js` loads them from `.env` at the factory root (`import 'dotenv/config'`); the `factory` command loads the same file.

| Variable | Required | Default | What it does |
|---|---|---|---|
| `ORCHESTRATOR_API_KEY` | yes | | The Orchestrator API key. It also names the organisation. |
| `ORCHESTRATOR_API_SECRET` | yes | | The Orchestrator API secret |
| `FACTORY_LOCATION` | yes | | Where this factory session runs. The Orchestrator sends it only runs of stations on lines whose location matches. One session per organisation and location. |
| `ORCHESTRATOR_URL` | no | `https://orchestrator.assemblyline.sh` | The Orchestrator to talk to; `http://localhost:3000` for one on your machine |
| `POLL_INTERVAL_MS` | no | `2000` | How often the session asks the Orchestrator for a run, in milliseconds. A value that doesn't parse as a number, or `0`, means the default. |

- **`startFactory()` checks the required three** at start and exits naming any that is missing.
- **`npx factory stations run`** uses the key, the secret and `ORCHESTRATOR_URL` to read the station's config, and doesn't read `FACTORY_LOCATION`. With `--empty`, it calls the Orchestrator for nothing.
- **Your stations' own variables,** such as an API key for a system they call, go in the same `.env` and are read by your code: see [Give stations their credentials](/docs/guides/environment-and-secrets).

al-orc and al-control don't read `.env`: they keep their own config files, in [al-orc](/docs/reference/al-orc#config) and [al-control](/docs/reference/al-control#config).
