# Sync to Coolify

Connect one Seekrit environment to one Coolify application and deployment target.
Values default to runtime availability. Select build time, or build time and
runtime, only for values the build needs. Redeploy the application in Coolify
to pick up the changes. This connector was tested with Coolify 4.7.6.
[Coolify environment variables](https://coolify.io/docs/applications/configuration/environment-variables)

## Connect an instance

Enable the API on the Coolify instance and create a team API token with
`read` and `write` access to the application. Add `delete` for the default
deletion policy, or select **Retain** (`--on-delete retain`) to use just
`read` and `write`. Seekrit reads variable names and UUIDs, so you can leave
`read:sensitive` and `deploy` disabled. Use a publicly reachable HTTPS
hostname on port 443. You can enter the instance origin or its `/api/v1` URL.

Under **Sync → Add connection → Coolify**, enter the instance URL and token.
To use the CLI, pipe the token to `sync connect`.

```bash
printf '%s' "$COOLIFY_TOKEN" | seekrit sync connect --name my-coolify \
  --provider coolify --base-url https://coolify.example.com
```

## Choose the environment and target

Copy the application UUID from Coolify. Choose **Production** or **Preview** in
the binding form and select when the variables should be available. To manage
both targets, create one binding for each and select its source environment.
Coolify shares its preview variables across this application's preview deployments.

```bash
seekrit sync verify my-coolify --provider coolify --coolify-app "$APP_UUID"
seekrit sync enable --connection my-coolify --provider coolify \
  --coolify-app "$APP_UUID" --target production --coolify-availability runtime \
  --app storefront --env production --acknowledge-decryption
```

Enabling sync grants the connection access to decrypt the source environment
and sends the selected values to Coolify. The application's existing variables
with matching names in that target will be updated. Use the binding's filters
to choose which names Seekrit manages. [Third-party sync](/docs/guides/third-party-sync)

## How writes and removals work

- Coolify can copy a newly created production variable into preview. Seekrit
  creates a new production key with an empty value, then updates only its
  production value. Coolify may leave an empty preview entry. An existing
  preview value stays independent. A retry can finish an interrupted creation.
- Seekrit sends literal values and preserves multiline content such as PEM
  files. Coolify trims edge whitespace when a value has no internal newline.
  Seekrit reports an error for values Coolify would trim or interpret as shared
  variable references.
- With deletion enabled, Seekrit looks up previously pushed names in the
  binding's target and deletes those entries by UUID. With retention enabled,
  removing a name from Seekrit leaves its Coolify value in place.
