Resolves compatibility application and environment configuration for Qdrant.
Application configuration takes precedence over environment variables. New code
should pass options directly to Qdrant.Client.new/1.
Configuration
Configure a full URL with :url:
config :qdrant,
url: "http://localhost:6333",
api_key: "your-api-key",
require_api_key: falseThe compatibility :database_url and :port options are also supported:
config :qdrant,
database_url: "http://localhost",
port: 6333,
api_key: "your-api-key"The equivalent environment variables are QDRANT_URL, QDRANT_DATABASE_URL,
QDRANT_PORT, QDRANT_API_KEY, QDRANT_REQUIRE_API_KEY, and
QDRANT_ALLOW_INSECURE_API_KEY.
Full URLs take precedence over database URL and port settings. When no URL is
configured, the default is "http://localhost:6333".
require_api_key defaults to true for hosts equal to cloud.qdrant.io or
ending in .cloud.qdrant.io, and false otherwise. Environment booleans must
be "true" or "false", and ports must be integers from 1 through 65535.
Summary
Functions
Returns the validated base URL for compatibility requests.
Returns the options resolved from compatibility application configuration and environment variables.
Returns the Tesla adapter used for compatibility requests.
Returns the API key from application configuration or QDRANT_API_KEY.
Returns the configured database URL without a port.
Returns the configured Qdrant port.
Returns the configured full Qdrant URL, without applying fallback settings.
Returns whether API key authentication is required.
Functions
@spec base_url() :: String.t()
Returns the validated base URL for compatibility requests.
Configuration is checked in this order: application :url, application
:database_url and :port, QDRANT_URL, QDRANT_DATABASE_URL and
QDRANT_PORT, QDRANT_PORT with localhost, and the default URL.
Raises Qdrant.Error when the configured URL or port is invalid.
@spec client_options() :: {:ok, keyword()} | {:error, Qdrant.Error.t()}
Returns the options resolved from compatibility application configuration and environment variables.
The returned options can be passed to Qdrant.Client.new/1. Invalid URL,
port, boolean, interface, or other configuration values are returned as
{:error, %Qdrant.Error{kind: :configuration}}.
Optional application settings for :interface, :adapter, :adapter_opts, :base_path,
and :max_response_bytes are included when configured.
Returns the Tesla adapter used for compatibility requests.
An :adapter option takes precedence, followed by application :adapter,
application :tesla_adapter, and Tesla.Adapter.Finch.
@spec get_api_key() :: String.t() | nil
Returns the API key from application configuration or QDRANT_API_KEY.
Application :api_key takes precedence. Returns nil when no API key is
configured.
@spec get_database_url() :: String.t()
Returns the configured database URL without a port.
Checks application :database_url, then QDRANT_DATABASE_URL, and defaults
to "http://localhost".
@spec get_port() :: pos_integer()
Returns the configured Qdrant port.
Checks application :port, then QDRANT_PORT, and defaults to 6333. The
value must be an integer from 1 through 65535; invalid values raise
Qdrant.Error.
@spec get_url() :: String.t() | nil
Returns the configured full Qdrant URL, without applying fallback settings.
Returns nil when neither application :url nor QDRANT_URL is set.
@spec require_api_key?() :: boolean()
Returns whether API key authentication is required.
An explicit application :require_api_key or QDRANT_REQUIRE_API_KEY value
takes precedence. When no value is configured, authentication is required for
Qdrant Cloud hosts and optional for other hosts.
Raises Qdrant.Error when the configured boolean or URL is invalid.