Settings

Settings are controlled with environment variables and, for feature access, an optional config file.

Required ClickHouse Settings

CLICKHOUSE_HOST=https://your-clickhouse-host:8443
CLICKHOUSE_USER=monitoring
CLICKHOUSE_PASSWORD=change-me

For multiple hosts, use comma-separated values in the same order:

CLICKHOUSE_HOST=https://prod-a:8443,https://prod-b:8443
CLICKHOUSE_USER=monitoring,monitoring
CLICKHOUSE_PASSWORD=secret-a,secret-b
CLICKHOUSE_NAME=prod-a,prod-b

Query Runtime

CLICKHOUSE_MAX_EXECUTION_TIME=60
CLICKHOUSE_TZ=UTC
NEXT_QUERY_CACHE_TTL=300

Use a shorter cache TTL when you need fresher operational data. Use a longer TTL for shared dashboards where lower ClickHouse load matters more than second-by-second freshness.

Feature Permissions

All features are public and enabled by default. You only need to configure features you want to restrict or disable.

# Make agent require authentication
CHM_FEATURE_AGENT_ACCESS=authenticated

# Disable settings entirely
CHM_FEATURE_SETTINGS_ENABLED=false

# Require auth for multiple features at once
CHM_AUTH_REQUIRED_FEATURES=agent,mcp,settings,actions

For complex setups, use a TOML or YAML config file:

CHM_CONFIG_FILE=/etc/clickhouse-monitor/config.toml
[features.agent]
access = "authenticated"

[features.settings]
enabled = false

[features.mcp]
access = "authenticated"

See Feature Permissions for all available options.

Clerk Authentication

Only needed when a feature is set to access = "authenticated":

CHM_AUTH_PROVIDER=clerk
NEXT_PUBLIC_AUTH_PROVIDER=clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxx
CLERK_SECRET_KEY=sk_live_xxx

AI Provider

The AI agent uses an OpenAI-compatible API.

LLM_API_KEY=your-provider-key
LLM_API_BASE=https://your-provider-compatible-endpoint/v1
LLM_MODEL=your-model

Keep server-side API keys out of NEXT_PUBLIC_ variables.

Agent Conversation Storage

History stays in browser localStorage unless server persistence is enabled:

AGENT_CONVERSATION_PERSISTENCE=true
AGENT_CONVERSATION_STORE=auto

Use agentstate, d1, durable-object, clickhouse, or postgres for durable server storage. Server stores require authenticated user identity; when that is unavailable, the agent falls back to local browser history.

See Agent Conversation Storage for backend env examples and setup commands.

Public Branding

NEXT_PUBLIC_LOGO=https://example.com/logo.svg
NEXT_PUBLIC_VERCEL_ANALYTICS_ENABLED=false
NEXT_PUBLIC_MEASUREMENT_ID=G-XXXXXXXXXX
NEXT_PUBLIC_SELINE_ENABLED=false

Only use NEXT_PUBLIC_ for values that are safe to expose to every browser.