# Configuration

URL: https://zerodev.ca/docs/kora/configuration

> What lives in config.json, the environment variables Kora reads and where everything else is set.



Kora keeps only what it needs to start in `config.json`. Everything else is stored in your database and changed from the dashboard.

| Where             | What                                                             |
| ----------------- | ---------------------------------------------------------------- |
| `config.json`     | Sign-in secret, database connection, ports and public URLs.      |
| **Settings** page | Language, appearance, sign-in, updates and the client dashboard. |
| **Configs** page  | Settings for each module.                                        |

The [setup wizard](/docs/kora/setup) fills in `config.json` for you. You only need to edit it to move to a new database or change a port.

## config.json

Kora creates this file on the first start.

```json title="config.json"
{
    "AUTHENTICATION": {
        "SECRET": "generated-on-first-start"
    },
    "DATABASE": {
        "TYPE": "POSTGRES",
        "HOST": "localhost",
        "PORT": "5432",
        "USER": "admin",
        "PASSWORD": "password",
        "DATABASE": "Kora"
    },
    "SERVER": {
        "DASHBOARD": {
            "PORT": 3000,
            "URL": null,
            "DEVELOPER": false
        },
        "API": {
            "PORT": 3001,
            "URL": null,
            "LOGS": true
        }
    }
}
```

| Key                                         | What it does                                                                                                       |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `AUTHENTICATION.SECRET`                     | Signs dashboard sessions and Kora's internal tokens. Generated for you. Leave it alone once Kora is running.       |
| `DATABASE.TYPE`                             | `POSTGRES`, `MYSQL` or `MARIADB`.                                                                                  |
| `DATABASE.HOST`, `PORT`, `USER`, `PASSWORD` | How to reach the database.                                                                                         |
| `DATABASE.DATABASE`                         | The database name. It must already exist.                                                                          |
| `SERVER.DASHBOARD.PORT`                     | Dashboard port.                                                                                                    |
| `SERVER.DASHBOARD.URL`                      | Public dashboard address, such as `https://kora.example.com`. Used for Discord sign-in.                            |
| `SERVER.DASHBOARD.DEVELOPER`                | Serves the dashboard with live reload. Only for working on Kora itself.                                            |
| `SERVER.API.PORT`                           | API port. Your products send validation requests here.                                                             |
| `SERVER.API.URL`                            | Public API address, such as `https://api.kora.example.com`. Shown in the code samples on the **Integration** page. |
| `SERVER.API.LOGS`                           | Prints each API request to the console.                                                                            |

Leave both URLs as `null` while running on your own computer. Set them from **Settings > Server URLs** when you move to a domain.

## Environment Variables

These override `config.json` when set, which suits Docker and panels that only let you set variables.

| Variable                 | Overrides               |
| ------------------------ | ----------------------- |
| `KORA_DATABASE_TYPE`     | `DATABASE.TYPE`         |
| `KORA_DATABASE_HOST`     | `DATABASE.HOST`         |
| `KORA_DATABASE_PORT`     | `DATABASE.PORT`         |
| `KORA_DATABASE_USER`     | `DATABASE.USER`         |
| `KORA_DATABASE_PASSWORD` | `DATABASE.PASSWORD`     |
| `KORA_DATABASE_NAME`     | `DATABASE.DATABASE`     |
| `KORA_DASHBOARD_PORT`    | `SERVER.DASHBOARD.PORT` |
| `KORA_DASHBOARD_URL`     | `SERVER.DASHBOARD.URL`  |
| `KORA_API_PORT`          | `SERVER.API.PORT`       |
| `KORA_API_URL`           | `SERVER.API.URL`        |

## Settings Page

| Section                 | What it holds                                                                                                         |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------- |
| Language                | Dashboard language and the fallback language.                                                                         |
| Console                 | Debug output, API request logs, 12-hour clock and seconds in timestamps.                                              |
| Updates                 | Your version, update checks and automatic updates.                                                                    |
| Appearance              | Light, dark or system mode and the accent colour.                                                                     |
| Dashboard Customization | Sidebar position, background, tint, blur, glass panels and custom CSS.                                                |
| Branding                | Dashboard name and icon.                                                                                              |
| Login Screen            | Sign-in form side and background.                                                                                     |
| Server URLs             | Public dashboard and API addresses. Changing them asks for a restart.                                                 |
| Client Dashboard        | Lets customers sign in. On by default.                                                                                |
| Discord Sign In         | Discord client ID and secret.                                                                                         |
| Response Signing Key    | The Ed25519 key that signs validation responses. See [Signed Responses](/docs/kora/extensions/core#signed-responses). |

## Module Settings

Each module has its own page under **Configs**:

* [Core](/docs/kora/extensions/core/configuration): key format, statuses, validation rules and leak detection.
* [Stores](/docs/kora/extensions/stores/configuration): what refunds and disputes do to licenses, and each store's secrets.
* [Discord](/docs/kora/extensions/discord/configuration): bot token, validation logs and status.

## Resetting

To start over, stop Kora and run:

```bash
npm run factory-reset
```

It asks you to type the database name, then drops every Kora table and clears the settings cache. The next start runs the setup wizard again with your database connection kept.

| Flag    | Effect                                                         |
| ------- | -------------------------------------------------------------- |
| `--all` | Also deletes `config.json`, so the wizard starts from scratch. |
| `--yes` | Skips the confirmation.                                        |
