# Configuration

The development setup is configured using environment variables.
The variables are loaded and merged in the following order:

1. from environment
2. from optional .env file in project folder
3. from optional .env.[NODE_ENV] in project folder

For local QA-targeted development (the supported baseline), copy
`.env.shadow` to `.env` and start from there. See
[Local development](local-development.md) for the impersonation flow,
required OA roles, and known quirks.

## Variables

| Name                | Default value                                | Description                                                                                        |
| ------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| ENV                 | qa                                           | Target environment for the local server (`qa` for QA-backed local dev).                            |
| API_URL             | https://api-dev.theorchard.io                | The base url to the API rest service.                                                              |
| CDN_URL             | https://cdn.theorchard.io                    | The base url to the CDN for static assets.                                                         |
| GRAPHQL_URL         | https://qa-graphql-gateway.theorchard.io/... | GraphQL endpoint. The gateway URL is rewritten to the graphql-router at runtime when the FF is on. |
| AUTH0_DOMAIN        | qalogin.theorchard.com                       | Auth0 tenant used for SSO and JWT issuance.                                                        |
| AUTH0_CLIENT_ID     | (see `.env.shadow`)                          | Auth0 client id. A wrong value produces an opaque login error screen.                              |
| AUTH0_AUDIENCE      | https://workstation.qaorch.com/api           | Auth0 audience for the issued access token.                                                        |
| POEDITOR_PROJECT_ID | undefined                                    | Project ID for associated POEditor project.                                                        |
| POEDITOR_API_TOKEN  | undefined                                    | API token for accessing POEditor account.                                                          |
| CLI_SERVER_PORT     | 8080                                         | Port used when running dev server.                                                                 |
| CLI_SERVER_HOST     | localhost                                    | Host name used when running dev server.                                                            |

### Example of `.env.shadow` file

```bash
ENV=qa

API_URL=https://grassproxy.pullrequests.qaorch.com
CDN_URL=https://qa-cdn.theorchard.io
GRAPHQL_URL=https://qa-graphql-gateway.theorchard.io/graphql

AUTH0_DOMAIN=qalogin.theorchard.com
AUTH0_CLIENT_ID=UwAkQHgn1qszdr59k2A3kn8FuYITQ373
AUTH0_AUDIENCE=https://workstation.qaorch.com/api

CLI_SERVER_HOST=localhost
CLI_SERVER_PORT=8080

POEDITOR_PROJECT_ID=
POEDITOR_API_TOKEN=
```

### A note on `GRASS_TOKEN`

Older `.env.shadow` files shipped a top-level `GRASS_TOKEN=` line for a
fixed-token local impersonation shortcut. That path was supported once but
is gone now, the app no longer reads the variable at all. Impersonate via
the flow in [Local development](local-development.md) instead. If you still
have `GRASS_TOKEN` in your `.env` its harmless, just drop it.
