connection:update
Change settings, secrets or transport security of an existing connection.
Interactively updates an existing database connection stored in clonio.json.
Usage
clonio connection:update [<name>]
The name argument is optional. When omitted, Clonio selects the connection automatically if only one exists, or presents a choice prompt when multiple connections are configured.
In non-interactive mode (--no-interaction), the choice prompt is unavailable: if multiple connections exist and no name is given, the command fails with exit code 2 instead of guessing. Pass the connection name explicitly when scripting against multiple connections.
Interactive flow
- Select connection — If
nameis not provided and multiple connections exist, a choice prompt lists all connection names. If only one connection exists it is selected automatically. - Edit fields — All fields are presented with their current values pre-filled as defaults. Press
Enterto keep a value unchanged. - Driver change — If the database driver is changed to a type with a different set of required fields (e.g. switching from MySQL to SQLite), fields that no longer apply are dropped and new required fields are prompted without defaults.
- Password — The existing password is never decrypted or shown. A blank response keeps the current encrypted value. Entering a new password encrypts it before saving.
- Transport security — Pre-selected with the stored mode (
Driver defaultif none is stored). Certificate path prompts show the stored value: press Enter to keep it, typenoneto remove it, or enter a new path. Switching torequiredrops the CA; switching todisableorDriver defaultdrops all certificate paths. A legacy SQL Servertrust_server_certificate: trueis pre-selected asrequireand replaced byssl: { mode: require }on save. - Review changes — A diff table shows only the fields that changed, with
OldandNewcolumns. If the password changed it is shown as••••••••in both columns. - Confirm save — A confirmation prompt (
Save changes? [Y/n]) defaults to yes. Answering no cancels without writing any changes.
Exit codes
| Code | Constant | Meaning |
|---|---|---|
0 |
Success |
Connection updated successfully, or save cancelled by user |
2 |
ConfigError |
Connection not found, or no connections exist in clonio.json |
4 |
ValidationError |
New name conflicts with an existing connection |
5 |
IoError |
Failed to write clonio.json |
Notes
Name change — If the connection name is changed to a value not already in use, the old entry is removed and the new one is written atomically via renameConnection. If the new name is already taken the command exits with code 4 before writing anything.
Driver change — Changing the driver type resets network fields (host, port) and optional fields (schema) that are not applicable to the new driver. The user is prompted for all required fields of the new driver without pre-filled defaults.
Password handling — Passwords are stored encrypted. The update command never exposes the stored ciphertext. Leaving the password prompt blank preserves the existing encrypted value unchanged.
Transport security changes — The diff shows ssl.mode, ssl.ca, ssl.cert and ssl.key changes before saving.