> ## Documentation Index
> Fetch the complete documentation index at: https://libops-renovate-github-com-libops-sitectl-0-x.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# config

> Manage sitectl contexts — local and remote Docker Compose sites.

export const Compose = () => <Tooltip headline="Compose" tip={<>
        Docker Compose is Docker's tool for defining and running multi-container applications.{" "}
        <a href="https://docs.docker.com/compose/">https://docs.docker.com/compose/</a>.
      </>}>
    <>
      <Icon icon="docker" />
      {" "}
      Compose
    </>
  </Tooltip>;

A sitectl context points to a <Compose /> site running either on your local machine or on a remote server over SSH. You can have many contexts and switch between them with `use-context`.

See the [context concept page](/context) for a full explanation.

## config

A sitectl config can have multiple contexts.

A sitectl context is a docker compose site running somewhere. "Somewhere" meaning:

* on your laptop (`--type` local)
* on a remote server (`--type` remote).

Remote contexts require SSH access to the remote server from where sitectl is being ran from.
When creating a context the remote server DNS name, SSH port, SSH username, and the path to your SSH private key will need to be set in the context configuration.

You can have a default context which will be used when running sitectl commands, unless the context is overridden with the `--context` flag.

```bash theme={null}
sitectl config <command>
```

## current-context

Display the current site context

```bash theme={null}
sitectl config current-context
```

## get-contexts

List all site contexts

```bash theme={null}
sitectl config get-contexts
```

## get-environments

List environments grouped by site

```bash theme={null}
sitectl config get-environments [site]
```

## get-sites

List configured sites and their environments

```bash theme={null}
sitectl config get-sites
```

## set-context

Set or update properties of a context. Creates a new context if it does not exist.

```bash theme={null}
sitectl config set-context [context-name]
```

| Flag                         | Default                | Description                                                                                               |
| ---------------------------- | ---------------------- | --------------------------------------------------------------------------------------------------------- |
| `-f, --compose-file`         | `[]`                   | docker compose file paths to use (equivalent to docker compose -f flag). Multiple files can be specified. |
| `--compose-network`          |                        | Primary Docker Compose network name for this environment                                                  |
| `--compose-project-name`     |                        | Docker Compose project name, matching COMPOSE\_PROJECT\_NAME or compose name:                             |
| `--database-name`            | `drupal_default`       | Name of the database to connect to (e.g. drupal\_default)                                                 |
| `--database-password-secret` | `DB_ROOT_PASSWORD`     | Name of the docker compose secret containing the database password                                        |
| `--database-service`         | `mariadb`              | Name of the database service in Docker Compose                                                            |
| `--database-user`            | `root`                 | Database user to connect as (e.g. root, admin)                                                            |
| `--default`                  | `false`                | set to default context                                                                                    |
| `--docker-socket`            | `/var/run/docker.sock` | Path to Docker socket                                                                                     |
| `--env-file`                 | `[]`                   | when running remote docker commands, the `--env-file` paths to pass to docker compose                     |
| `--environment`              |                        | Environment name for this context, such as local, dev, staging, or prod                                   |
| `--plugin`                   | `core`                 | Owning plugin identifier for this context, such as core, isle, or drupal                                  |
| `--project-dir`              |                        | Path to docker compose project directory                                                                  |
| `--project-name`             | `docker-compose`       | Logical project name for this context                                                                     |
| `--site`                     |                        | Logical site name this context belongs to                                                                 |
| `--ssh-hostname`             |                        | Remote contexts DNS name for the host.                                                                    |
| `--ssh-key`                  |                        | Path to SSH private key for remote context. e.g. /home/node/.ssh/id\_rsa                                  |
| `--ssh-port`                 | `2222`                 | Port number                                                                                               |
| `--ssh-user`                 |                        | SSH user for remote context                                                                               |
| `--sudo`                     | `false`                | for remote contexts, run docker commands as sudo                                                          |
| `--type`                     | `local`                | Type of context: local or remote                                                                          |

## use-context

Switch to the specified context

```bash theme={null}
sitectl config use-context [context-name]
```

## delete-context

Delete a site context

```bash theme={null}
sitectl config delete-context [context-name]
```

## validate

Validate sitectl context configuration and access

```bash theme={null}
sitectl config validate [context-name]
```

| Flag       | Default   | Description                                         |
| ---------- | --------- | --------------------------------------------------- |
| `--all`    | `false`   | Validate all configured contexts                    |
| `--format` | `section` | Report output format: section, table, json, or yaml |
| `--site`   |           | Validate all contexts for a specific site           |

## view

Print your sitectl config

```bash theme={null}
sitectl config view
```
