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

# Development

> The Cosmo router contains functionality intended to be used to assist the development of the router and/or subgraphs that are connected through the router. Most of these features should not be enabled for production, since they could impact performance in negative ways.

### Connect to your subgraphs running on localhost from Docker

A common setup for development is running subgraphs on `localhost` and the executing router inside Docker. To avoid requiring additional configuration steps in this environment and to make this setup more ergonomic, when running inside Docker the router will retry requests that fail to connect to a loopback address, sending them to `docker.host.internal` instead.

This feature is enabled by default, but it can be disabled by setting the environment variable `LOCALHOST_FALLBACK_INSIDE_DOCKER` to `false`.

### Hot reload the router configuration file

When working on the router configuration without changing router versions, custom modules, etc, it can be helpful to enable hot reloading of the configuration file.

> [!WARNING]
>
> Config watcher hot reloading is not recommended for production. A reload, triggered by `watch_config` or by `SIGHUP`, stops the running router before it starts a new one with the updated configuration:
>
> * The router stops accepting connections until the new router is listening. Clients receive connection errors in the meantime.
> * In-flight requests have at most `shutdown_delay` to complete. WebSocket and SSE subscriptions are closed.
> * If the new router fails to start, the process exits. The previous router is not kept running. Causes include an invalid TLS certificate, a port that is already in use, or an execution config that cannot be fetched at reload time.
> * If the configuration file fails to load or validate, the router restarts with the previous configuration.
>
> In production, roll out router configuration changes by redeploying the router instances. Execution config updates, from the CDN or `execution_config.file.watch`, do not restart the router and keep accepting connections. They close long-lived WebSocket and SSE subscriptions, so clients must reconnect. See [Config Hot Reload](https://cosmo-docs.wundergraph.com/router/deployment/config-hot-reload.md).

You can enable file watching based hot config reloading using the following configuration:

```yaml config.yaml theme={"system"}
watch_config:
  enabled: true
  interval: "10s"

  startup_delay:
    enabled: false
    maximum: "10s"
```

Alternatively, the router will always reload when it receives a SIGHUP signal. You can do this on MacOS/Linux using `kill -HUP <pid>`.

> [!NOTE]
>
> Hot reloading has some limitations:
>
> * Changes to the `watch_config` section are not hot-reloaded.
> * Changes to flags and environment variables are not possible.
> * `watch_config` based reloads are based on the filesystem's modification time, edits that somehow circumvent this mechanism will not trigger a reload.


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