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

# Exporting Your Configuration

> Export the configuration a GoModel gateway started now would run with as one config.yaml, from the binary, Docker Compose, or docker, and why the dashboard has no export button.

`gomodel config export` prints the configuration a gateway started now would
run with as one `config.yaml`: your `config.yaml`, environment variables, and
the objects saved in the dashboard, such as providers, virtual models, users,
and budgets. Use it to review a setup, keep it in Git, or start another
instance from it.

## Export

Run the command where the gateway runs, so it reads the same files,
environment, and database. It is safe while the gateway is running. Logs go to
stderr, so the file holds only the configuration.

It reads the files and environment afresh, not the running gateway. If you
edited `config.yaml` and the gateway rejected the reload, the export shows the
edited file, or fails with the same error.

> [tab] Binary
>
> From the directory the gateway starts in, with the same environment:
>
> ```bash theme={null}
> gomodel config export > gomodel-export.yaml
> ```

> [tab] Docker Compose
>
> ```bash theme={null}
> docker compose exec -T gomodel /gomodel config export > gomodel-export.yaml
> ```
>
> `gomodel` is the service name in your `docker-compose.yaml`. `-T` turns
> off terminal allocation, so the file gets the output unchanged.

> [tab] docker
>
> ```bash theme={null}
> docker exec gomodel /gomodel config export > gomodel-export.yaml
> ```
>
> `gomodel` is the container name (`docker ps`).

> [!WARNING]
>
> Write to a new file, never onto the `config.yaml` the gateway reads: the
> shell empties that file before the command starts.

Settings at their default value are left out, so the file shows only what you
changed. Add `--include-defaults` to write the defaults too, except settings
that are empty by default.

## Secrets

Secret settings, such as API keys, are written as references, never as
values:

```yaml theme={null}
providers:
  openai:
    type: openai
    api_key: "${env:OPENAI_API_KEY}"
  groq:
    type: groq
    api_key: "${env:GOMODEL_PROVIDERS_GROQ_API_KEY}" # secret not exported: set GOMODEL_PROVIDERS_GROQ_API_KEY
```

A key typed into the dashboard gets a `# secret not exported` comment naming
the variable to set. A gateway loading the file does not start until that
variable is set.

Free-form text, such as a description, is only checked for credential shapes,
so a token pasted into one can end up in the file. Review such text before
sharing it.

## Use the export

Save it as `config/config.yaml` on the target instance (in Docker, mount it at
`/app/config/config.yaml`), set the variables it references, and start the
gateway. Objects that came from the dashboard are now
declared in the file, so they are read-only in the dashboard.

> [!NOTE]
>
> Not everything has a `config.yaml` form. Managed API keys, workflows,
> guardrails created in the dashboard, model pricing overrides, runtime
> settings, disabled provider credentials, and MCP server display names are
> not exported, and are listed in the file's header. They stay in the database:
> to carry them over, point the target instance at that database or restore a
> [backup](https://gomodel.enterpilot.io/docs/guides/updating.md#1-back-up-the-database) of it there.

## Why the dashboard has no export button

The export is deliberately a shell command, with no HTTP endpoint behind it.

* **It describes the whole deployment.** Even without secrets, it lists every
  upstream, database, and internal URL, and where each credential lives.
* **A dashboard login should not be enough to take it.** An endpoint would hand
  the file to anyone with an admin login, or a stolen one. Shell access to the
  gateway is a narrower group, which can already read its files and
  environment.
* **Redaction has limits.** A token pasted into a description is written as
  is, so the file should not be one click away.

See [Exporting the Effective Configuration](https://gomodel.enterpilot.io/docs/advanced/config-yaml.md#exporting-the-effective-configuration)
for the full rules.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.