Conversation
…vars Writes CLICKHOUSE_HOST, CLICKHOUSE_PORT, CLICKHOUSE_HTTP_PORT, CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, and CLICKHOUSE_DATABASE into a .env file from a running server's connection details. Supports --name to target a specific server and --local to write to .env.local instead. If the file already exists, CLICKHOUSE_* vars are replaced in-place rather than appending duplicates. Closes #90 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
iskakaushik
approved these changes
Apr 10, 2026
Two fixes to `local server dotenv`: 1. Only write vars we actually know from server metadata (host, ports). User, password, and database are no longer hard-coded — instead they are opt-in via --user, --password, --database flags. This prevents overwriting a working .env with incorrect defaults. 2. The dotenv updater now handles common variants: `export` prefix and whitespace around `=`. Previously `export CLICKHOUSE_HOST=x` would survive replacement and produce a duplicate line. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
If the existing .env file uses `export CLICKHOUSE_X=val`, the replacement now keeps the `export` prefix instead of silently dropping it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Values like `my secret#123` are now written as `"my secret#123"`. Embedded double quotes, backslashes, and newlines are escaped. Plain alphanumeric values remain unquoted. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
iskakaushik
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
clickhousectl local server dotenvcommand that writes ClickHouse connection env vars (CLICKHOUSE_HOST,CLICKHOUSE_PORT,CLICKHOUSE_HTTP_PORT,CLICKHOUSE_USER,CLICKHOUSE_PASSWORD,CLICKHOUSE_DATABASE) to a.envfile from a running server's details--name <server>to target a specific server (defaults todefault) and--localto write to.env.localinstead.envfile already exists, existingCLICKHOUSE_*vars are replaced in-place; missing vars are appendedCloses #90
Test plan
cargo buildpassescargo testpasses (255 tests, 4 new forupdate_dotenvlogic)cargo clippycleanclickhousectl local server dotenv, verify.envcontents--localflag writes to.env.local🤖 Generated with Claude Code