Ir al contenido
Empezar gratis en Cloud

HitKeep Flags and Environment Variables

Esta página aún no está disponible en tu idioma.

HitKeep follows the 12-factor app methodology. You can configure the application using either command-line flags or environment variables.

Flags take precedence over environment variables.

For citable runtime facts, including binary size, memory use, storage boundaries, exports, and MCP limits, see Facts and Limits.

Flag name compatibility: Several older flag names still work but are deprecated. The generated tables label each deprecated spelling beside its replacement.

The tables on this page are rendered from the configuration catalog attached to the latest stable HitKeep release. Names, defaults, descriptions, sensitivity, deprecations, and cloud scope come from the same annotations the runtime uses to load configuration.

These are the most critical settings to get HitKeep running correctly.

FlagEnvironment variableDefaultDescription
--auth-remember-me-daysHITKEEP_AUTH_REMEMBER_ME_DAYS30Remember-me session lifetime in days
--auth-session-minutesHITKEEP_AUTH_SESSION_MINUTES15Authenticated dashboard session lifetime in minutes
--auth-session-warning-secondsHITKEEP_AUTH_SESSION_WARNING_SECONDS120Seconds before session expiry to warn users
--healthcheckN/AfalseRun as healthcheck client
--http-addrDeprecated: -httpHITKEEP_HTTP_ADDR:8080HTTP listen address
--jwt-secretHITKEEP_JWT_SECRETrandomly generatedSecret key for JWTSensitive value; redacted in safe configuration output.
--log-levelHITKEEP_LOG_LEVELinfoLog level (debug/info/warn/error)
--public-urlHITKEEP_PUBLIC_URLhttp://localhost:8080Public URL

Use a bare origin when HitKeep owns a hostname:

Terminal window
HITKEEP_PUBLIC_URL=https://analytics.example.com

Use a path-prefixed URL when your reverse proxy mounts HitKeep below another site:

Terminal window
HITKEEP_PUBLIC_URL=https://www.example.net/hitkeep/

With a path prefix, HitKeep serves the dashboard shell with <base href="/hitkeep/" />, accepts dashboard API requests below /hitkeep/api/..., and serves tracker files below /hitkeep/hk.js and /hitkeep/hk-vitals.js. The tracker derives /ingest, /ingest/event, and /ingest/web-vitals from the script URL, so a snippet loaded from /hitkeep/hk.js posts back to /hitkeep/ingest. Root /api/..., /hk.js, and dashboard routes are not public fallback routes in this mode. Local /healthz and /readyz remain available for process, container, and Kubernetes checks.

Keep the reverse proxy prefix and HITKEEP_PUBLIC_URL in sync. A mismatch usually appears as a login page that loads but cannot call /api/status, or as a tracker snippet that loads from one path and posts pageviews to another.

Custom tracking domains use the same dashboard flow on HitKeep Cloud and self-hosted installs. Teams add domains in Team Settings, prove ownership with a TXT record, point DNS at an allowed target, and use Site Settings to generate tracking snippets from the instance URL or any active team domain. See Custom Tracking Domains for the full flow.

FlagEnvironment variableDefaultDescription
--caddy-tls-ask-tokenHITKEEP_CADDY_TLS_ASK_TOKEN""Bearer-free path token for Caddy on-demand TLS ask endpointSensitive value; redacted in safe configuration output.
--custom-tracking-dns-targetHITKEEP_CUSTOM_TRACKING_DNS_TARGET""DNS host or IP custom tracking domains must point at; defaults to public URL host
--custom-tracking-tls-modeHITKEEP_CUSTOM_TRACKING_TLS_MODEexternalTLS mode for custom tracking domains: external or caddy-on-demand

When HITKEEP_CUSTOM_TRACKING_TLS_MODE=caddy-on-demand, configure Caddy with an ask URL that includes the token. HitKeep returns 204 only for enabled DNS-verified custom tracking domains, so arbitrary hostnames cannot request certificates through your Caddy instance.

FlagEnvironment variableDefaultDescription
--archive-pathHITKEEP_ARCHIVE_PATHarchiveData archive path
--data-pathHITKEEP_DATA_PATHdataLocal writable base directory for per-tenant database files
--data-retention-daysDeprecated: -retention-daysHITKEEP_DATA_RETENTION_DAYS365Default data retention in days
--db-auto-recoverHITKEEP_DB_AUTO_RECOVERtrueAutomatically recover recognized DuckDB non-unique index invalidations after creating a local recovery bundle
--db-auto-recover-walHITKEEP_DB_AUTO_RECOVER_WALfalseAfter retaining a recovery bundle, automatically bypass a recognized non-migration WAL and accept loss of WAL-only changes
--db-checkpoint-intervalHITKEEP_DB_CHECKPOINT_INTERVAL5Minutes between periodic DuckDB checkpoints; 0 disables periodic checkpoints
--db-compact-on-startHITKEEP_DB_COMPACT_ON_STARTtrueRewrite fragmented database files on startup and tenant open to return space freed by retention and deletes to the operating system
--db-pathDeprecated: -dbHITKEEP_DB_PATHhitkeep.dbDatabase file path
--db-recovery-pathHITKEEP_DB_RECOVERY_PATH<data-path>/recoveryDirectory for permission-restricted DuckDB recovery bundles; defaults to <data-path>/recovery
--duckdb-memory-limitHITKEEP_DUCKDB_MEMORY_LIMITderivedDuckDB memory limit per database (e.g. 2GB); empty derives a container-aware default, 'none' keeps the DuckDB default of 80% of system RAM
--duckdb-threadsHITKEEP_DUCKDB_THREADSGOMAXPROCSDuckDB threads per database; 0 derives the default from GOMAXPROCS
--import-max-stage-bytesHITKEEP_IMPORT_MAX_STAGE_BYTES107374182400Maximum staged import upload size in bytes
--import-stage-retention-daysHITKEEP_IMPORT_STAGE_RETENTION_DAYS7Days to keep stale staged import upload files; 0 disables import staging cleanup

HITKEEP_DB_PATH is the local SQLite control database. HITKEEP_DATA_PATH holds the local tenant DuckDB files and must also be writable. S3 is supported for HITKEEP_BACKUP_PATH and retention archives, not for live database files. In 2.13 HitKeep first moves default-tenant analytics to {data-path}/tenants/{default-tenant-id}/hitkeep.db, then converts the compact control database to SQLite; there is no opt-out flag. The verified former DuckDB control file is retained as <db-path>.pre-sqlite-2.13.0. Keep a complete pre-upgrade backup because downgrading to 2.12 or older is unsupported.

Tenant analytics use one shared DuckDB instance rooted at the default tenant file. All attached tenant catalogs share its buffer pool, memory limit, thread setting, and global connection gate. The pure-Go SQLite control pool is separately bounded. HitKeep derives a container-aware tenant DuckDB limit automatically; explicit values follow one rule of thumb:

Terminal window
# Rule of thumb: about twice the largest actively queried tenant database.
HITKEEP_DUCKDB_MEMORY_LIMIT=2GB

Do not set the limit far below your database size: DuckDB spills query intermediates to disk, but writes need real memory headroom, and an overly tight limit causes query failures under concurrent load. Reducing HITKEEP_DUCKDB_THREADS lowers peak query memory and lets a given limit go further.

See Performance and Memory for the full picture, including the derived defaults and the DuckDB memory breakdown in System Status → Storage.

HitKeep can use a local spam-filter cache for known referrer spam and abuse networks. Automatic refresh is off by default for offline and airgapped installs.

FlagEnvironment variableDefaultDescription
--spam-filter-auto-updateHITKEEP_SPAM_FILTER_AUTO_UPDATEfalseAutomatically refresh OSS spam filter feeds on the leader node (disabled by default for airgapped/offline installs)
--spam-filter-pathHITKEEP_SPAM_FILTER_PATH""Path to cached spam filter data (defaults to <data-path>/spam-filter.json)
--spam-filter-update-intervalHITKEEP_SPAM_FILTER_UPDATE_INTERVAL1440Minutes between OSS spam filter feed refreshes

See Bot and Spam Filtering for update commands and operator guidance.

HitKeep can periodically export all live databases (shared + per-tenant) to Parquet snapshots. Set HITKEEP_BACKUP_PATH to enable.

FlagEnvironment variableDefaultDescription
--backup-intervalHITKEEP_BACKUP_INTERVAL60Minutes between backups
--backup-pathHITKEEP_BACKUP_PATH""Backup snapshot destination (local directory or s3://); live databases remain on the local data path
--backup-retentionHITKEEP_BACKUP_RETENTION24Number of backup snapshots to keep

When HITKEEP_BACKUP_PATH is an s3:// URL, the same S3 credentials configured below are used. For local paths, old snapshots beyond the retention count are automatically deleted. For S3, configure lifecycle policies on your bucket.

See Backups and Restore and S3 Backups for concrete layouts and restore examples.

When HITKEEP_ARCHIVE_PATH is set to an s3:// URL, HitKeep writes Parquet archives directly to S3-compatible storage via DuckDB’s httpfs extension.

Authentication mode is auto-detected:

  • If HITKEEP_S3_ACCESS_KEY_ID and HITKEEP_S3_SECRET_ACCESS_KEY are both set, HitKeep uses static credentials.
  • If neither is set, HitKeep uses the AWS credential chain (environment variables, shared config, instance profiles, STS, SSO).
FlagEnvironment variableDefaultDescription
--s3-access-key-idHITKEEP_S3_ACCESS_KEY_ID""S3 access key ID (static credentials)Sensitive value; masked in safe configuration output.
--s3-endpointHITKEEP_S3_ENDPOINT""S3 custom endpoint (MinIO, R2, Spaces)
--s3-regionHITKEEP_S3_REGIONus-east-1S3 region
--s3-secret-access-keyHITKEEP_S3_SECRET_ACCESS_KEY""S3 secret access key (static credentials)Sensitive value; redacted in safe configuration output.
--s3-session-tokenHITKEEP_S3_SESSION_TOKEN""S3 session token (STS temporary credentials)Sensitive value; redacted in safe configuration output.
--s3-url-styleHITKEEP_S3_URL_STYLE""S3 URL style: path or vhost
--s3-use-sslHITKEEP_S3_USE_SSLtrueS3 use SSL (set false for local MinIO over HTTP)

See S3 Backups for end-to-end examples with AWS S3, MinIO, and Cloudflare R2.

Settings for binding ports and clustering nodes.

FlagEnvironment variableDefaultDescription
--bind-addrDeprecated: -bindHITKEEP_BIND_ADDR0.0.0.0:7946Address for cluster gossip
--join-addrDeprecated: -joinHITKEEP_JOIN_ADDR""Address of a peer to join
--node-nameDeprecated: -nameHITKEEP_NODE_NAMEhostname-timestampUnique node name

MCP is disabled by default. When enabled, it is mounted on the leader’s main HTTP server and serves read-only aggregate analytics plus official documentation tools over MCP Streamable HTTP.

FlagEnvironment variableDefaultDescription
--mcp-docs-cache-minutesHITKEEP_MCP_DOCS_CACHE_MINUTES60Minutes to cache fetched docs for MCP tools
--mcp-docs-enabledHITKEEP_MCP_DOCS_ENABLEDtrueEnable MCP tools and resources that read official HitKeep docs
--mcp-docs-urlHITKEEP_MCP_DOCS_URLhttps://hitkeep.comBase URL for official HitKeep docs used by MCP docs tools
--mcp-enabledHITKEEP_MCP_ENABLEDfalseEnable the optional leader-only MCP server
--mcp-max-range-daysHITKEEP_MCP_MAX_RANGE_DAYS366Maximum analytics date range in days for MCP tools
--mcp-pathHITKEEP_MCP_PATH/mcpMCP server HTTP path on the main HitKeep HTTP server

See Official MCP Server for setup and tool details.

AI-powered product features are disabled by default. When enabled, HitKeep uses the configured provider/model route and stores only audit metadata plus the validated customer-visible output. Ask AI has its own feature gate because it is an interactive dashboard-session feature.

Self-hosted operators configure the HitKeep route and budget fields through environment variables or flags. Provider credentials are resolved by the wrapped goAI provider, so set the selected provider’s own environment variables such as OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, or AWS credentials. Use the goAI supported providers documentation for provider-specific auth and endpoint variables. HitKeep Cloud can run the same route fields as cloud-managed configuration, with provider secrets managed outside the customer dashboard.

Use this reference for exact field names and defaults. For model selection, setup examples, and budget sizing, see AI Model Configuration.

FlagEnvironment variableDefaultDescription
--ai-api-keyHITKEEP_AI_API_KEY""Optional explicit AI provider API key, bearer token, or gateway key; provider-native goAI env vars are preferredSensitive value; redacted in safe configuration output.
--ai-base-urlHITKEEP_AI_BASE_URL""Optional explicit AI provider or gateway base URL
--ai-budget-windowHITKEEP_AI_BUDGET_WINDOW1440AI local budget window in minutes
--ai-enabledHITKEEP_AI_ENABLEDfalseEnable optional AI-powered product features
--ai-modelHITKEEP_AI_MODEL""AI model identifier for the configured provider
--ai-providerHITKEEP_AI_PROVIDER""AI provider key supported by HitKeep's GoAI router
--ai-regionHITKEEP_AI_REGION""Optional explicit AI provider region override
--ai-request-limitHITKEEP_AI_REQUEST_LIMIT100Maximum AI requests per budget window; 0 disables local request cap
--ai-timeout-secondsHITKEEP_AI_TIMEOUT_SECONDS30AI provider request timeout in seconds
--ai-token-limitHITKEEP_AI_TOKEN_LIMIT100000Maximum AI tokens per budget window; 0 disables local token cap
--ask-ai-enabledHITKEEP_ASK_AI_ENABLEDfalseEnable the optional dashboard Ask AI assistant; requires HITKEEP_AI_ENABLED and a configured AI model

The token limit is a local usage budget, not the model context window. The current Opportunities enrichment path asks the provider for a small validated JSON object and caps provider output at 900 tokens. Provider model limits still apply upstream.

The admin AI status endpoint reports whether AI is enabled and configured, the provider/model label, the configuration mode (self_hosted or cloud_managed), the current request/token budget state, and a safe last-error category. It never returns provider secrets, raw prompts, raw provider responses, or raw external error bodies.

Opportunities use deterministic detectors for opportunity type, evidence, impact, confidence, and status. AI may summarize or explain only cited evidence. The saved API output uses translation keys plus interpolation params so dashboard copy can be localized without changing stored records.

For a direct provider route, configure the HitKeep route and the provider’s goAI credential environment:

Terminal window
HITKEEP_AI_ENABLED=true
HITKEEP_ASK_AI_ENABLED=true
HITKEEP_AI_PROVIDER=openai
HITKEEP_AI_MODEL=your-json-capable-model
OPENAI_API_KEY=provider_key_from_your_secret_store

For an OpenAI-compatible gateway, configure a HitKeep base URL. Set HITKEEP_AI_API_KEY only when the gateway expects a bearer token:

Terminal window
HITKEEP_AI_ENABLED=true
HITKEEP_ASK_AI_ENABLED=true
HITKEEP_AI_PROVIDER=openai-compatible
HITKEEP_AI_MODEL=hitkeep-ai
HITKEEP_AI_BASE_URL=https://ai-gateway.example.com/v1

See AI Model Configuration for setup examples, Opportunity Recommendations for saved recommendation behavior, and Ask AI for dashboard-session assistant behavior, permissions, and one-off chat boundaries.

Outbound operational webhooks are enabled as part of the normal HitKeep runtime. Most installations can keep these defaults. Production destinations require HTTPS and must resolve only to public addresses; the development-target flag removes that protection for explicit local testing.

FlagEnvironment variableDefaultDescription
--webhook-allow-development-targetsHITKEEP_WEBHOOK_ALLOW_DEVELOPMENT_TARGETSfalseAllow HTTP and private webhook destinations for explicit development/self-host testing
--webhook-delivery-concurrencyHITKEEP_WEBHOOK_DELIVERY_CONCURRENCY8Maximum concurrent outbound webhook deliveries
--webhook-delivery-timeoutHITKEEP_WEBHOOK_DELIVERY_TIMEOUT10Outbound webhook request timeout in seconds
--webhook-max-attemptsHITKEEP_WEBHOOK_MAX_ATTEMPTS6Maximum outbound webhook delivery attempts
--webhook-per-endpoint-concurrencyHITKEEP_WEBHOOK_PER_ENDPOINT_CONCURRENCY1Maximum concurrent deliveries for one webhook
--webhook-retention-daysHITKEEP_WEBHOOK_RETENTION_DAYS30Days to retain webhook delivery logs
--webhook-retry-base-secondsHITKEEP_WEBHOOK_RETRY_BASE_SECONDS30Initial outbound webhook retry delay in seconds
--webhook-retry-max-secondsHITKEEP_WEBHOOK_RETRY_MAX_SECONDS21600Maximum outbound webhook retry delay in seconds
--webhook-sweep-secondsHITKEEP_WEBHOOK_SWEEP_SECONDS30Seconds between pending webhook delivery recovery sweeps

See Signed Outbound Webhooks for event scopes, HMAC verification, retry semantics, destination validation, and secret rotation.

Self-hosted installs must configure a Google OAuth web client before teams can connect Search Console, map properties, and import Search Analytics rows.

FlagEnvironment variableDefaultDescription
--google-search-console-client-idHITKEEP_GOOGLE_SEARCH_CONSOLE_CLIENT_ID""Google Search Console OAuth client ID
--google-search-console-client-secretHITKEEP_GOOGLE_SEARCH_CONSOLE_CLIENT_SECRET""Google Search Console OAuth client secretSensitive value; redacted in safe configuration output.
--google-search-console-redirect-urlHITKEEP_GOOGLE_SEARCH_CONSOLE_REDIRECT_URL""Google Search Console OAuth callback URL override

Enable the Google Search Console API in the same Google Cloud project that owns the OAuth client. See Google Search Console Integration for the Google Cloud setup and sync behavior.

OAuth client pairs enable the corresponding social provider. Callback URLs derive from HITKEEP_PUBLIC_URL; Microsoft defaults to the common tenant selector. Keep client secrets in your deployment secret store.

FlagEnvironment variableDefaultDescription
--social-github-client-idHITKEEP_SOCIAL_GITHUB_CLIENT_ID""GitHub social sign-in OAuth client ID
--social-github-client-secretHITKEEP_SOCIAL_GITHUB_CLIENT_SECRET""GitHub social sign-in OAuth client secretSensitive value; redacted in safe configuration output.
--social-google-client-idHITKEEP_SOCIAL_GOOGLE_CLIENT_ID""Google social sign-in OAuth client ID
--social-google-client-secretHITKEEP_SOCIAL_GOOGLE_CLIENT_SECRET""Google social sign-in OAuth client secretSensitive value; redacted in safe configuration output.
--social-microsoft-client-idHITKEEP_SOCIAL_MICROSOFT_CLIENT_ID""Microsoft social sign-in OAuth client ID
--social-microsoft-client-secretHITKEEP_SOCIAL_MICROSOFT_CLIENT_SECRET""Microsoft social sign-in OAuth client secretSensitive value; redacted in safe configuration output.
--social-microsoft-tenantHITKEEP_SOCIAL_MICROSOFT_TENANTcommonMicrosoft tenant selector: common, organizations, consumers, or tenant UUID
--social-signup-enabledHITKEEP_SOCIAL_SIGNUP_ENABLEDfalseEnable managed-cloud account creation through configured social providers

See Configure Social Sign-In for exact Google, GitHub, and Microsoft callback URLs, provider-console steps, Docker Compose examples, account rules, and troubleshooting.

Required for “Forgot Password” functionality.

FlagEnvironment variableDefaultDescription
--mail-driverHITKEEP_MAIL_DRIVERsmtpMail driver
--mail-encryptionHITKEEP_MAIL_ENCRYPTIONtlsMail encryption
--mail-from-addressHITKEEP_MAIL_FROM_ADDRESShitkeep@localhostFrom Email
--mail-from-nameHITKEEP_MAIL_FROM_NAMEHitKeepFrom Name
--mail-hostHITKEEP_MAIL_HOST""SMTP Host
--mail-insecure-skip-verifyHITKEEP_MAIL_INSECURE_SKIP_VERIFYfalseDisable Cert validation
--mail-passwordHITKEEP_MAIL_PASSWORD""SMTP PasswordSensitive value; redacted in safe configuration output.
--mail-portHITKEEP_MAIL_PORT587SMTP Port
--mail-usernameHITKEEP_MAIL_USERNAME""SMTP Username

HitKeep includes a built-in rate limiter to protect against abuse. Limits are defined per IP address.

Ingestion (/ingest, /ingest/event, /api/ingest/server/*)

Section titled “Ingestion (/ingest, /ingest/event, /api/ingest/server/*)”

High-throughput endpoints for the browser tracker and trusted server-side pageview or event ingest. Server-side ingest still requires an API client token and can be called by non-browser clients without Origin or Referer headers, but it uses this ingest limiter because log forwarders and edge workers often send bursts from one IP.

FlagEnvironment variableDefaultDescription
--api-burstHITKEEP_API_BURST20API burst
--api-rate-limitDeprecated: -api-rateHITKEEP_API_RATE_LIMIT10API rate limit
--auth-burstHITKEEP_AUTH_BURST5Auth burst
--auth-rate-limitDeprecated: -auth-rateHITKEEP_AUTH_RATE_LIMIT2Auth rate limit
--ingest-burstHITKEEP_INGEST_BURST40Ingest burst
--ingest-rate-limitDeprecated: -ingest-rateHITKEEP_INGEST_RATE_LIMIT20Ingest rate limit
--webhook-burstHITKEEP_WEBHOOK_BURST60Webhook burst
--webhook-rate-limitDeprecated: -webhook-rateHITKEEP_WEBHOOK_RATE_LIMIT30Webhook rate limit

General data retrieval endpoints.

Import lifecycle and chunk upload requests use the normal API limiter above. The staged upload size is controlled by HITKEEP_IMPORT_MAX_STAGE_BYTES. Stale staged import files are cleaned after HITKEEP_IMPORT_STAGE_RETENTION_DAYS; set the value to 0 to disable cleanup.

Strict limits to prevent brute-force attacks.

Incoming cloud integration webhook routes use a separate limiter. These limits do not control outbound operational webhook delivery.

Use this when HitKeep is behind a reverse proxy or load balancer and you want to trust forwarded headers. This affects rate limiting, spam checks, IP exclusions, and derived IP metadata accuracy for country, region, city, provider, and ASN fields. HitKeep uses the resolved IP transiently for these decisions and does not store the raw visitor IP.

FlagEnvironment variableDefaultDescription
--trusted-proxiesHITKEEP_TRUSTED_PROXIES*Trusted proxy CIDRs (comma-separated) or '*' to trust all

Behavior:

  • The default * expands to all IPv4 and IPv6 networks.
  • With *, HitKeep uses the first valid IP in X-Forwarded-For when that header is present.
  • If set to CIDRs, HitKeep only trusts forwarded headers when the direct connection IP is in the trusted list.
  • If set to an empty value, HitKeep ignores forwarded headers and uses the direct connection IP.

Configuration for embedded components. You generally do not need to change these unless you are developing HitKeep or have port conflicts on the host network.

FlagEnvironment variableDefaultDescription
--nsq-http-addressHITKEEP_NSQ_HTTP_ADDRESS127.0.0.1:4151Internal NSQ HTTP
--nsq-tcp-addressHITKEEP_NSQ_TCP_ADDRESS127.0.0.1:4150Internal NSQ TCP

Cloud-hosted builds have additional internal HITKEEP_CLOUD_* and HITKEEP_STRIPE_* variables used by managed HitKeep Cloud. They are not needed for self-hosted installs.