Files
dev_tools/README.md
T
mathias e97205c4bf Hide changed connection lines behind -v/--verbose
set_local_db/set_dot_env diffs can contain secrets (connection
strings), so printing them unconditionally on every up/down leaked
credentials to stdout. Default output is now a line-count summary;
pass -v/--verbose to see the actual before/after lines.
2026-09-18 17:59:55 +02:00

2.2 KiB

dev_tools

CLI tool to start and stop a local RCC test environment. It manages a Docker Compose service and toggles environment variable files between local and CI database configurations.

Prerequisites

  • Rust toolchain (stable)
  • Docker with Compose plugin

Configuration

The tool reads from a dotenv-style file at ~/.config/rcc/dev. The following variables are required:

Variable Description
DOCKER_SERVICE Name of the Docker container to check if it is running
DOCKER_DIR Path to the Docker Compose directory, relative to $HOME
<PROJECT>_DIR Absolute path to the project directory (one per project, e.g. FOO_DIR)

Example ~/.config/rcc/dev:

DOCKER_SERVICE=my-container
DOCKER_DIR=repos/docker/local
FOO_DIR=/home/user/repos/foo

Build & Install

cargo build --release
# or install directly into ~/.cargo/bin
cargo install --path .

Usage

dev_tools <project> <up|down> [-v|--verbose]
Argument Description
project Project key (matches <PROJECT>_DIR in the config, case-insensitive)
up / down Start or stop the environment
-v, --verbose Print the actual before/after lines changed in the env files (values may include secrets, e.g. connection strings). Without it, only a line count is printed.

Examples

# Start the environment for project "foo"
dev_tools foo up

# Stop it
dev_tools foo down

# See exactly which lines were changed
dev_tools foo up -v

What it does

  1. Starts or stops the Docker Compose service defined by DOCKER_SERVICE / DOCKER_DIR.
  2. conf/global/connections.env: up toggles it to the CI credentials and marks it git update-index --assume-unchanged to avoid accidental commits; down unmarks it and restores it to its committed state by reading the committed blob with git cat-file (rather than computing the reverse toggle or running git checkout, which would fire the repo's post-checkout hook), so it's guaranteed byte-for-byte identical to HEAD.
  3. Toggles database connection entries in <PROJECT_DIR>/conf/local/.env: up switches the connection to ci, down switches it to staging.

Tests

cargo test