Always update connections.env and fix double-toggled connection line

Drop the --legacy flag: set_local_db and toggle_index now run
unconditionally instead of only when -l was passed, since that was the
flag's only effect.

Fix set_dot_env writing the connection/RCC_CONNECTION line twice with
opposing polarity (once from the #docker pass, once from the #cidb
pass), which flipped it to the wrong value. Collapsed the three
separate open/read/write passes into one, toggling both sections and
the connection line in a single scan so the connection line is only
ever touched once.
This commit is contained in:
2026-09-17 15:12:32 +02:00
parent 36752606a6
commit 3873987c19
4 changed files with 112 additions and 140 deletions
+3 -7
View File
@@ -35,14 +35,13 @@ cargo install --path .
## Usage
```
dev_tools <project> <up|down> [--legacy]
dev_tools <project> <up|down>
```
| Argument | Description |
|---|---|
| `project` | Project key (matches `<PROJECT>_DIR` in the config, case-insensitive) |
| `up` / `down` | Start or stop the environment |
| `-l`, `--legacy` | Enable legacy mode: also toggles `conf/global/connections.env` and runs `git update-index` |
### Examples
@@ -52,16 +51,13 @@ dev_tools foo up
# Stop it
dev_tools foo down
# Start with legacy env handling
dev_tools foo up --legacy
```
## What it does
1. Starts or stops the Docker Compose service defined by `DOCKER_SERVICE` / `DOCKER_DIR`.
2. Toggles database connection entries in `<PROJECT_DIR>/conf/local/.env` between `staging` and CI values.
3. With `--legacy`: additionally modifies `conf/global/connections.env` and marks it with `git update-index --assume-unchanged` to avoid accidental commits.
2. Modifies `conf/global/connections.env` and marks it with `git update-index --assume-unchanged` to avoid accidental commits.
3. Toggles database connection entries in `<PROJECT_DIR>/conf/local/.env`: `up` switches the connection to `ci`, `down` switches it to `staging`.
## Tests