Posthog.Config (posthog v1.1.0)
View SourceHandles configuration validation and defaults for the PostHog client.
This module validates the configuration at compile time and provides sensible defaults for optional values.
Summary
Functions
Validates and returns the API key from the configuration.
Validates and returns the API URL from the configuration.
Returns whether event capture is enabled.
Returns the HTTP client module to use.
Returns the HTTP client options.
Returns the JSON library to use for encoding/decoding.
Validates the entire PostHog configuration at compile time.
Functions
Validates and returns the API key from the configuration.
Raises a helpful error message if the key is missing or invalid.
Validates and returns the API URL from the configuration.
Raises a helpful error message if the URL is missing or invalid.
Returns whether event capture is enabled.
Defaults to true if not configured.
Returns the HTTP client module to use.
Defaults to Posthog.HTTPClient.Hackney if not configured.
Returns the HTTP client options.
Defaults to:
- timeout: 5_000 (5 seconds)
- retries: 3
- retry_delay: 1_000 (1 second)
Returns the JSON library to use for encoding/decoding.
Defaults to Jason if not configured.
Validates the entire PostHog configuration at compile time.
This ensures that all required configuration is present and valid before the application starts.