:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { isDevEnv, isProdEnv, isTestEnv } from '~/common/utils/env-utils'
import type { BaseServerConfig } from '../servers/base-server'
export const DEFAULT_HTTP_SERVER_PORT = 6738
// Public dev-only default for the internal API secret. Never accepted as a valid secret in production
// (mirrors LOCAL_DEV_INTERNAL_API_SECRET on the Django side).
export const LOCAL_DEV_INTERNAL_API_SECRET = 'posthog123'
/**
* Response budget for a request to a host we don't run, used by `fetch`/`legacyFetch` in
* common/utils/request.ts. A CDP destination points at whatever API the customer configured, which
* is routinely in another region and under no latency obligation to us, so it has different needs
* from EXTERNAL_REQUEST_TIMEOUT_MS, which is sized for calls between our own services on the same
* network.
*
* Starts equal to the internal budget so the split changes no behavior on its own. Raise it with
* EXTERNAL_REQUEST_THIRD_PARTY_TIMEOUT_MS to buy slower third-party APIs more headroom; an
* unanswered request holds its worker slot for the whole budget, so the cost lands on
* cdp_http_inflight_requests.
*/
export const DEFAULT_THIRD_PARTY_REQUEST_TIMEOUT_MS = 3000
export enum KafkaSaslMechanism {
Plain = 'plain',
ScramSha256 = 'scram-sha-256',
ScramSha512 = 'scram-sha-512',
}
export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
export enum PluginServerMode {
ingestion_v2 = 'ingestion-v2',
local_cdp = 'local-cdp',
recordings_blob_ingestion_v2 = 'recordings-blob-ingestion-v2',
// TODO: Remove once charts deploy with mode=recordings-blob-ingestion-v2 for overflow pods
recordings_blob_ingestion_v2_overflow = 'recordings-blob-ingestion-v2-overflow',
recordings_blob_ingestion_v2_ml_mirror = 'recordings-blob-ingestion-v2-ml-mirror',
recordings_blob_ingestion_v2_ml_parquet_sink = 'recordings-blob-ingestion-v2-ml-parquet-sink',
recordings_blob_ingestion_v2_ml_image_scrub = 'recordings-blob-ingestion-v2-ml-image-scrub',
recordings_blob_ingestion_v2_ml_image_scrub_dlq_replay = 'recordings-blob-ingestion-v2-ml-image-scrub-dlq-replay',
recordings_blob_ingestion_v2_ml_image_fetch = 'recordings-blob-ingestion-v2-ml-image-fetch',
recordings_blob_ingestion_v2_ml_image_fetch_retry = 'recordings-blob-ingestion-v2-ml-image-fetch-retry',
ai_research_v4_image_fetch = 'ai-research-v4-image-fetch',
ai_research_v4_image_fetch_retry = 'ai-research-v4-image-fetch-retry',
ai_research_v4_parquet_sink = 'ai-research-v4-parquet-sink',
cdp_processed_events = 'cdp-processed-events',
cdp_person_updates = 'cdp-person-updates',
cdp_data_warehouse_events = 'cdp-data-warehouse-events',
cdp_internal_events = 'cdp-internal-events',
cdp_cyclotron_worker = 'cdp-cyclotron-worker',
// TODO: remove once charts stop setting PLUGIN_SERVER_MODE=cdp-precalculated-filters.
// The consumer is gone; an unknown mode would throw at boot, so keep the member until then.
cdp_precalculated_filters = 'cdp-precalculated-filters',
cdp_hogflow_subscription_matcher = 'cdp-hogflow-subscription-matcher',
cdp_cohort_membership = 'cdp-cohort-membership',
cdp_cohort_membership_triggers = 'cdp-cohort-membership-triggers',
cdp_cyclotron_worker_hogflow = 'cdp-cyclotron-worker-hogflow',
cdp_cyclotron_worker_email = 'cdp-cyclotron-worker-email',
cdp_api = 'cdp-api',
cdp_legacy_on_event = 'cdp-legacy-on-event',
evaluation_scheduler = 'evaluation-scheduler',
ingestion_logs = 'ingestion-logs',
ingestion_error_tracking = 'ingestion-errortracking',
ingestion_metrics = 'ingestion-metrics',
cdp_cyclotron_worker_batch_resolve = 'cdp-cyclotron-worker-batch-resolve',
cdp_cyclotron_v2_janitor = 'cdp-cyclotron-v2-janitor',
cdp_rerun_worker = 'cdp-rerun-worker',
cdp_dlq_replay = 'cdp-dlq-replay',
recording_api = 'recording-api',
ingestion_v2_combined = 'ingestion-v2-combined',
ingestion_traces = 'ingestion-traces',
cdp_hogflow_scheduler = 'cdp-hogflow-scheduler',
ingestion_api = 'ingestion-api',
push_api = 'push-api',
}
export const stringToPluginServerMode = Object.fromEntries(
Object.entries(PluginServerMode).map(([key, value]) => [
value,
PluginServerMode[key as keyof typeof PluginServerMode],
])
) as Record<string, PluginServerMode>
export type CommonConfig = BaseServerConfig & {
// Observability
OTEL_EXPORTER_OTLP_ENDPOINT: string
OTEL_SDK_DISABLED: boolean
OTEL_TRACES_SAMPLER_ARG: number
OTEL_MAX_SPANS_PER_GROUP: number
OTEL_MIN_SPAN_DURATION_MS: number
/** OTLP metrics push target (e.g. capture-logs /v1/metrics); empty disables the meter provider. */
OTEL_METRICS_EXPORT_URL: string
/** Capture token identifying the team that receives the pushed metrics. */
OTEL_METRICS_EXPORT_TOKEN: string
OTEL_METRICS_EXPORT_INTERVAL_MS: number
DISABLE_OPENTELEMETRY_TRACING: boolean
// Tasks
TASK_TIMEOUT: number
// Database
DATABASE_URL: string
DATABASE_READONLY_URL: string
PERSONS_DATABASE_URL: string
BEHAVIORAL_COHORTS_DATABASE_URL: string
PERSONS_READONLY_DATABASE_URL: string
PLUGIN_STORAGE_DATABASE_URL: string
POSTGRES_CONNECTION_POOL_SIZE: number
POSTHOG_DB_NAME: string | null
POSTHOG_DB_USER: string
POSTHOG_DB_PASSWORD: string
POSTHOG_POSTGRES_HOST: string
POSTHOG_POSTGRES_PORT: number
POSTGRES_BEHAVIORAL_COHORTS_HOST: string
POSTGRES_BEHAVIORAL_COHORTS_USER: string
POSTGRES_BEHAVIORAL_COHORTS_PASSWORD: string
// Schema check hook Job (nodejs/src/schema-check)
SCHEMA_CHECK_PUSHGATEWAY_URL: string
SCHEMA_CHECK_APP: string
// PersonHog gRPC
PERSONHOG_ENABLED: boolean
/**
* Which world the ingestion persons store writes: 'pg' (default),
* 'personhog', or 'shadow' (pg authoritative, personhog best-effort).
* Until the merge saga lands, merge events fail loudly in personhog
* mode, so it is only safe for traffic that produces none.
*/
PERSONS_STORE_MODE: string
/** Host and port of the personhog identity server. */
PERSONHOG_IDENTITY_ADDR: string
PERSONHOG_ADDR: string
PERSONHOG_GROUPS_ROLLOUT_PERCENTAGE: number
PERSONHOG_GROUPS_ROLLOUT_TEAM_IDS: string
PERSONHOG_PERSONS_ROLLOUT_PERCENTAGE: number
PERSONHOG_PERSONS_ROLLOUT_TEAM_IDS: string
PERSONHOG_TLS: boolean
PERSONHOG_TIMEOUT_MS: number
/** Per-call deadline on the identity connection; it outlasts identity's own leader attempts. */
PERSONHOG_IDENTITY_TIMEOUT_MS: number
/** Deadline for the identity merge saga call; must exceed the engine's lifecycle_execute_timeout_secs. */
PERSONHOG_MERGE_TIMEOUT_MS: number
PERSONHOG_READ_MAX_BYTES: number
PERSONHOG_WRITE_MAX_BYTES: number
PERSONHOG_PING_INTERVAL_MS: number
PERSONHOG_PING_TIMEOUT_MS: number
PERSONHOG_PING_IDLE_CONNECTION: boolean
PERSONHOG_IDLE_CONNECTION_TIMEOUT_MS: number
PERSONHOG_STATE_MONITOR_POLL_INTERVAL_MS: number
PERSONHOG_INITIAL_STREAM_WINDOW_BYTES: number
PERSONHOG_INITIAL_CONNECTION_WINDOW_BYTES: number
// Usage ingestion gRPC. One team list per deployment, because each reporting site is its
// own service: '' reports nothing, '*' every team, '1,2' those teams. No percentage: it
// would bill a fraction of a team.
USAGE_INGESTION_ADDR: string
USAGE_INGESTION_TLS: boolean
USAGE_INGESTION_TIMEOUT_MS: number
USAGE_INGESTION_MAX_BATCH_SIZE: number
USAGE_INGESTION_REPORT_TEAMS: string
// Redis
REDIS_URL: string
INGESTION_REDIS_HOST: string
INGESTION_REDIS_PORT: number
POSTHOG_REDIS_PASSWORD: string
POSTHOG_REDIS_HOST: string
POSTHOG_REDIS_PORT: number
REDIS_POOL_MIN_SIZE: number
REDIS_POOL_MAX_SIZE: number
// Kafka consumer base
CONSUMER_BATCH_SIZE: number
CONSUMER_MAX_HEARTBEAT_INTERVAL_MS: number
CONSUMER_LOOP_STALL_THRESHOLD_MS: number
CONSUMER_LOG_STATS_LEVEL: LogLevel
CONSUMER_LOOP_BASED_HEALTH_CHECK: boolean
CONSUMER_MAX_BACKGROUND_TASKS: number
CONSUMER_BACKGROUND_TASK_TIMEOUT_MS: number
CONSUMER_REBALANCE_TIMEOUT_MS: number
CONSUMER_AUTO_CREATE_TOPICS: boolean
/**
* When true, every Kafka consumer in this service uses KafkaConsumerV2; otherwise the
* legacy KafkaConsumer (v1) is used. Used by `createKafkaConsumer()` in
* `src/kafka/consumer/index.ts`. Will be removed once v1 is deleted.
*/
CONSUMER_USE_V2: boolean
// Kafka
KAFKA_HOSTS: string
KAFKA_CLIENT_RACK: string | undefined
KAFKA_CLIENT_CERT_B64: string | undefined
KAFKA_CLIENT_CERT_KEY_B64: string | undefined
KAFKA_TRUSTED_CERT_B64: string | undefined
KAFKA_SASL_MECHANISM: KafkaSaslMechanism | undefined
KAFKA_SASL_USER: string | undefined
KAFKA_SASL_PASSWORD: string | undefined
// Server
BASE_DIR: string
LOG_LEVEL: LogLevel
SCHEDULE_LOCK_TTL: number
HEALTHCHECK_MAX_STALE_SECONDS: number
KAFKA_HEALTHCHECK_SECONDS: number
PLUGIN_SERVER_MODE: PluginServerMode | null
NODEJS_CAPABILITY_GROUPS: string | null
PLUGIN_LOAD_SEQUENTIALLY: boolean
CLOUD_DEPLOYMENT: string | null
RELOAD_PLUGIN_JITTER_MAX_MS: number
// Shared services
SITE_URL: string
ENCRYPTION_SALT_KEYS: string
CAPTURE_INTERNAL_URL: string
CAPTURE_CONFIG_REDIS_HOST: string | null
MMDB_FILE_LOCATION: string
LAZY_LOADER_DEFAULT_BUFFER_MS: number
LAZY_LOADER_MAX_SIZE: number
INTERNAL_API_BASE_URL: string
HOGFLOW_SCHEDULER_POLL_INTERVAL_MS: number
HOGFLOW_SCHEDULER_MAX_POLL_INTERVAL_MS: number
HOGFLOW_SCHEDULER_HEALTH_TIMEOUT_MS: number
// Despite the EXTERNAL_REQUEST_ prefix this one only reaches `internalFetch`, so it is the
// budget for calls to our own services. Third-party hosts use the sibling below.
EXTERNAL_REQUEST_TIMEOUT_MS: number
EXTERNAL_REQUEST_THIRD_PARTY_TIMEOUT_MS: number
EXTERNAL_REQUEST_CONNECT_TIMEOUT_MS: number
EXTERNAL_REQUEST_KEEP_ALIVE_TIMEOUT_MS: number
EXTERNAL_REQUEST_CONNECTIONS: number
// The number of connections the HTTP/2 dispatchers open per origin. The request helper holds a burst to a cold
// origin behind one probe request, so this cap only bounds an origin that negotiates HTTP/1.1 and the spill past
// an HTTP/2 origin's stream limit. Keep it above the largest per-origin concurrency a caller runs. The image fetch
// lane allows 6 per registrable domain.
EXTERNAL_REQUEST_H2_CONNECTIONS: number
// Which teams send their third-party requests through the egress proxy. Only a deployment in the rollout sets
// this. Left unset, a configured proxy carries every request, which is the behavior from before the rollout.
// Takes the buildIntegerMatcherWithPercentage syntax: '2' for team 2 only, '2,*:0.1' for team 2 plus a tenth of
// everyone else's requests, '*' for all.
EXTERNAL_REQUEST_PROXY_TEAMS: string
// PostHog analytics
POSTHOG_API_KEY: string
POSTHOG_HOST_URL: string
OTEL_SERVICE_NAME: string | null
OTEL_SERVICE_ENVIRONMENT: string | null
// Shared between ingestion and CDP (used by hog transformer in both)
// Execute transformations on the Rust HogVM instead of the Node VM. Invocations the Rust VM
// can't run (unsupported host functions, addon not built) fall back to the Node VM.
CDP_HOG_RUST_VM_EXECUTION_ENABLED: boolean
// With the Rust VM enabled, coalesce concurrent same-program invocations into one
// executeBatch FFI call per tick, executed off the JS event loop, instead of per-invocation
// executeSync on the JS thread.
CDP_HOG_RUST_VM_BATCH_EXECUTION_ENABLED: boolean
// Timeout for the internal audience-resolution calls a batch workflow makes while paging its
// target audience. These run ClickHouse queries that routinely take longer than the 3s
// EXTERNAL_REQUEST_TIMEOUT_MS inter-service budget, so they get a larger one of their own —
// without it, resolving a non-trivial audience always times out and the whole batch run fails.
CDP_HOG_FLOW_BATCH_AUDIENCE_FETCH_TIMEOUT_MS: number
/** Per-function wall-clock budget for an event transformation, enforced by the HogVM. */
TRANSFORMATIONS_HOG_TIMEOUT_MS: number
// Event loop yield helper (yieldEventLoopIfNeeded)
EVENT_LOOP_YIELD_THRESHOLD_MS: number
}
export type ExternalRequestConfig = Pick<
CommonConfig,
| 'EXTERNAL_REQUEST_TIMEOUT_MS'
| 'EXTERNAL_REQUEST_THIRD_PARTY_TIMEOUT_MS'
| 'EXTERNAL_REQUEST_CONNECT_TIMEOUT_MS'
| 'EXTERNAL_REQUEST_KEEP_ALIVE_TIMEOUT_MS'
| 'EXTERNAL_REQUEST_CONNECTIONS'
| 'EXTERNAL_REQUEST_H2_CONNECTIONS'
| 'EXTERNAL_REQUEST_PROXY_TEAMS'
>
export function getExternalRequestConfig(): ExternalRequestConfig {
return {
EXTERNAL_REQUEST_TIMEOUT_MS: Number(process.env.EXTERNAL_REQUEST_TIMEOUT_MS ?? 3000),
EXTERNAL_REQUEST_THIRD_PARTY_TIMEOUT_MS: Number(
process.env.EXTERNAL_REQUEST_THIRD_PARTY_TIMEOUT_MS ?? DEFAULT_THIRD_PARTY_REQUEST_TIMEOUT_MS
),
EXTERNAL_REQUEST_CONNECT_TIMEOUT_MS: Number(process.env.EXTERNAL_REQUEST_CONNECT_TIMEOUT_MS ?? 3000),
EXTERNAL_REQUEST_KEEP_ALIVE_TIMEOUT_MS: Number(process.env.EXTERNAL_REQUEST_KEEP_ALIVE_TIMEOUT_MS ?? 10000),
EXTERNAL_REQUEST_CONNECTIONS: Number(process.env.EXTERNAL_REQUEST_CONNECTIONS ?? 500),
EXTERNAL_REQUEST_H2_CONNECTIONS: Number(process.env.EXTERNAL_REQUEST_H2_CONNECTIONS ?? 8),
EXTERNAL_REQUEST_PROXY_TEAMS: process.env.EXTERNAL_REQUEST_PROXY_TEAMS ?? '',
}
}
export function getDefaultCommonConfig(): CommonConfig {
return {
// Observability
CONTINUOUS_PROFILING_ENABLED: false,
PYROSCOPE_SERVER_ADDRESS: '',
PYROSCOPE_APPLICATION_NAME: '',
INSTRUMENT_THREAD_PERFORMANCE: false,
OTEL_EXPORTER_OTLP_ENDPOINT: isDevEnv() ? 'http://localhost:4317' : '',
OTEL_SDK_DISABLED: isDevEnv() ? false : true,
OTEL_TRACES_SAMPLER_ARG: 1,
OTEL_MAX_SPANS_PER_GROUP: 2,
OTEL_MIN_SPAN_DURATION_MS: 50,
OTEL_METRICS_EXPORT_URL: '',
OTEL_METRICS_EXPORT_TOKEN: '',
OTEL_METRICS_EXPORT_INTERVAL_MS: 15000,
DISABLE_OPENTELEMETRY_TRACING: false,
// Tasks
TASK_TIMEOUT: 30,
// Database
DATABASE_URL: isTestEnv()
? 'postgres://posthog:posthog@localhost:5432/test_posthog'
: isDevEnv()
? 'postgres://posthog:posthog@localhost:5432/posthog'
: '',
DATABASE_READONLY_URL: '',
PERSONS_DATABASE_URL: isTestEnv()
? 'postgres://posthog:posthog@localhost:5432/test_persons'
: isDevEnv()
? 'postgres://posthog:posthog@localhost:5432/posthog_persons'
: '',
BEHAVIORAL_COHORTS_DATABASE_URL: isTestEnv()
? 'postgres://posthog:posthog@localhost:5432/test_behavioral_cohorts'
: isDevEnv()
? 'postgres://posthog:posthog@localhost:5432/behavioral_cohorts'
: '',
PERSONS_READONLY_DATABASE_URL: isTestEnv()
? 'postgres://posthog:posthog@localhost:5432/test_persons'
: isDevEnv()
? 'postgres://posthog:posthog@localhost:5432/posthog_persons'
: '',
PLUGIN_STORAGE_DATABASE_URL: '',
POSTGRES_CONNECTION_POOL_SIZE: 10,
POSTHOG_DB_NAME: null,
POSTHOG_DB_USER: 'postgres',
POSTHOG_DB_PASSWORD: '',
POSTHOG_POSTGRES_HOST: 'localhost',
POSTHOG_POSTGRES_PORT: 5432,
POSTGRES_BEHAVIORAL_COHORTS_HOST: 'localhost',
POSTGRES_BEHAVIORAL_COHORTS_USER: 'postgres',
POSTGRES_BEHAVIORAL_COHORTS_PASSWORD: '',
// Schema check hook Job (nodejs/src/schema-check)
SCHEMA_CHECK_PUSHGATEWAY_URL: '',
SCHEMA_CHECK_APP: '',
// PersonHog gRPC
PERSONHOG_ENABLED: false,
PERSONHOG_ADDR: '',
PERSONS_STORE_MODE: 'pg',
PERSONHOG_IDENTITY_ADDR: '',
PERSONHOG_GROUPS_ROLLOUT_PERCENTAGE: 0,
PERSONHOG_GROUPS_ROLLOUT_TEAM_IDS: '',
PERSONHOG_PERSONS_ROLLOUT_PERCENTAGE: 0,
PERSONHOG_PERSONS_ROLLOUT_TEAM_IDS: '',
PERSONHOG_TLS: false,
PERSONHOG_TIMEOUT_MS: 3000,
PERSONHOG_IDENTITY_TIMEOUT_MS: 3000,
PERSONHOG_MERGE_TIMEOUT_MS: 35_000,
PERSONHOG_READ_MAX_BYTES: 128 * 1024 * 1024,
PERSONHOG_WRITE_MAX_BYTES: 4 * 1024 * 1024,
PERSONHOG_PING_INTERVAL_MS: 30_000,
PERSONHOG_PING_TIMEOUT_MS: 5_000,
PERSONHOG_PING_IDLE_CONNECTION: true,
PERSONHOG_IDLE_CONNECTION_TIMEOUT_MS: 15 * 60 * 1000,
PERSONHOG_STATE_MONITOR_POLL_INTERVAL_MS: 5_000,
PERSONHOG_INITIAL_STREAM_WINDOW_BYTES: 0,
PERSONHOG_INITIAL_CONNECTION_WINDOW_BYTES: 0,
// Usage ingestion gRPC
USAGE_INGESTION_ADDR: isDevEnv() ? 'localhost:7143' : '',
USAGE_INGESTION_TLS: false,
USAGE_INGESTION_TIMEOUT_MS: 5_000,
USAGE_INGESTION_MAX_BATCH_SIZE: 500,
USAGE_INGESTION_REPORT_TEAMS: '',
// Redis
// ok to connect to localhost over plaintext
// nosemgrep: trailofbits.generic.redis-unencrypted-transport.redis-unencrypted-transport
REDIS_URL: 'redis://127.0.0.1',
INGESTION_REDIS_HOST: '',
INGESTION_REDIS_PORT: 6379,
POSTHOG_REDIS_PASSWORD: '',
POSTHOG_REDIS_HOST: '',
POSTHOG_REDIS_PORT: 6379,
REDIS_POOL_MIN_SIZE: 1,
REDIS_POOL_MAX_SIZE: 3,
// Kafka consumer base
CONSUMER_BATCH_SIZE: 500,
CONSUMER_MAX_HEARTBEAT_INTERVAL_MS: 30_000,
CONSUMER_LOOP_STALL_THRESHOLD_MS: 60_000,
CONSUMER_LOG_STATS_LEVEL: 'debug',
CONSUMER_LOOP_BASED_HEALTH_CHECK: false,
CONSUMER_MAX_BACKGROUND_TASKS: 1,
CONSUMER_BACKGROUND_TASK_TIMEOUT_MS: 60_000,
CONSUMER_REBALANCE_TIMEOUT_MS: 20_000,
CONSUMER_AUTO_CREATE_TOPICS: true,
CONSUMER_USE_V2: false,
// Kafka
KAFKA_HOSTS: 'kafka:9092',
KAFKA_CLIENT_RACK: undefined,
KAFKA_CLIENT_CERT_B64: undefined,
KAFKA_CLIENT_CERT_KEY_B64: undefined,
KAFKA_TRUSTED_CERT_B64: undefined,
KAFKA_SASL_MECHANISM: undefined,
KAFKA_SASL_USER: undefined,
KAFKA_SASL_PASSWORD: undefined,
// Server
BASE_DIR: '..',
LOG_LEVEL: isTestEnv() ? 'warn' : 'info',
HTTP_SERVER_PORT: DEFAULT_HTTP_SERVER_PORT,
SCHEDULE_LOCK_TTL: 60,
HEALTHCHECK_MAX_STALE_SECONDS: 2 * 60 * 60,
KAFKA_HEALTHCHECK_SECONDS: 20,
PLUGIN_SERVER_MODE: null,
NODEJS_CAPABILITY_GROUPS: null,
PLUGIN_LOAD_SEQUENTIALLY: false,
CLOUD_DEPLOYMENT: null,
RELOAD_PLUGIN_JITTER_MAX_MS: 60000,
// Shared services
SITE_URL: isDevEnv() ? 'http://localhost:8000' : '',
ENCRYPTION_SALT_KEYS: isDevEnv() || isTestEnv() ? '00beef0000beef0000beef0000beef00' : '',
CAPTURE_INTERNAL_URL: isProdEnv()
? 'http://capture.posthog.svc.cluster.local:3000/capture'
: 'http://localhost:8010/capture',
CAPTURE_CONFIG_REDIS_HOST: null,
MMDB_FILE_LOCATION: '../share/GeoLite2-City.mmdb',
LAZY_LOADER_DEFAULT_BUFFER_MS: 10,
LAZY_LOADER_MAX_SIZE: 100_000,
INTERNAL_API_BASE_URL: isProdEnv()
? 'http://posthog-web-django.posthog.svc.cluster.local:8000'
: 'http://localhost:8000',
INTERNAL_API_SECRET: isProdEnv() ? '' : LOCAL_DEV_INTERNAL_API_SECRET,
INTERNAL_API_SECRET_FALLBACKS: '',
HOGFLOW_SCHEDULER_POLL_INTERVAL_MS: 60_000,
HOGFLOW_SCHEDULER_MAX_POLL_INTERVAL_MS: 5 * 60_000,
HOGFLOW_SCHEDULER_HEALTH_TIMEOUT_MS: 10 * 60_000,
EXTERNAL_REQUEST_TIMEOUT_MS: 3000,
EXTERNAL_REQUEST_THIRD_PARTY_TIMEOUT_MS: DEFAULT_THIRD_PARTY_REQUEST_TIMEOUT_MS,
EXTERNAL_REQUEST_CONNECT_TIMEOUT_MS: 3000,
EXTERNAL_REQUEST_KEEP_ALIVE_TIMEOUT_MS: 10000,
EXTERNAL_REQUEST_CONNECTIONS: 500,
EXTERNAL_REQUEST_H2_CONNECTIONS: 8,
EXTERNAL_REQUEST_PROXY_TEAMS: '',
// PostHog analytics
POSTHOG_API_KEY: '',
POSTHOG_HOST_URL: 'http://localhost:8010',
OTEL_SERVICE_NAME: null,
OTEL_SERVICE_ENVIRONMENT: null,
// Shared between ingestion and CDP
CDP_HOG_RUST_VM_EXECUTION_ENABLED: false,
CDP_HOG_RUST_VM_BATCH_EXECUTION_ENABLED: false,
// Above Django's WORKFLOWS_BATCH_AUDIENCE_QUERY_TIMEOUT_SECONDS (180s), so ClickHouse ends a slow
// audience query before this client gives up and a retry never overlaps a query that still runs.
CDP_HOG_FLOW_BATCH_AUDIENCE_FETCH_TIMEOUT_MS: 185_000,
TRANSFORMATIONS_HOG_TIMEOUT_MS: 300,
// Event loop yield helper
EVENT_LOOP_YIELD_THRESHOLD_MS: 200,
HTTP_SERVER_DRAIN_TIMEOUT_MS: 0,
// Pod termination
POD_TERMINATION_ENABLED: false,
POD_TERMINATION_BASE_TIMEOUT_MINUTES: 30,
POD_TERMINATION_JITTER_MINUTES: 45,
}
}