Skip to content

Config

Configuration management for kxi.

The primary entrypoint is the settings singleton, which provides access to the active connection profile, environment overrides, and credentials.

Example

Read the current connection URL and switch profiles:

from kxi.config import settings

# Read the active profile's connection URL
host = settings.runtime.hostname

# Switch to a named profile
settings.profile = "production"
host = settings.runtime.hostname

# Reload settings after editing config files on disk
settings.reload()

Classes:

  • BaseConfig – File path settings for kxi configuration.
  • KXIConfig – Full kxi configuration including all named profiles.
  • KXIProfile – Connection profile settings for kdb Insights Enterprise.

BaseConfig

Bases: BaseSettings

File path settings for kxi configuration.

All paths default to ~/.insights/ but can be overridden via environment variables. The root directory itself is controlled by the INSIGHTS_CONFIG_HOME environment variable.

Attributes:

  • config_toml_path (Path) – Main TOML config file. Env: KXI_CONFIG_PATH. Default: ~/.insights/config.toml.
  • pakx_config_path (Path) – pakx config file. Env: PAKX_CONFIG_PATH. Default: ~/.insights/pakx-config.
  • pakx_sources_path (Path) – pakx sources file. Env: PAKX_SOURCES_PATH. Default: ~/.insights/pakx.sources.
  • credentials_path (Path) – Credentials TOML file. Env: CREDENTIALS_PATH. Default: ~/.insights/credentials.toml.
  • config_ini_path (Path) – Legacy ini-format config (versions 1.11 and below). Default: ~/.insights/cli-config.

Functions:

  • set_root – Set the root path for the config.

set_root

set_root(root)

Set the root path for the config.

KXIConfig

Bases: KXBaseConfig

Full kxi configuration including all named profiles.

Loaded from ~/.insights/config.toml and the legacy ~/.insights/cli-config. Manages profile selection and persistence. Access via settings.kxi.

Attributes:

Example
from kxi.config import settings

# List all configured profiles
print(list(settings.kxi.profiles.keys()))

# Save config changes to disk
settings.kxi.save()

Functions:

  • get_current – Get the current profile.
  • save – Save the config to disk.
  • save_ini – Save the config in ini format to disk.

get_current

get_current()

Get the current profile.

save

save()

Save the config to disk.

save_ini

save_ini()

Save the config in ini format to disk.

KXIProfile

Bases: KXBaseConfig

Connection profile settings for kdb Insights Enterprise.

Values are loaded from the active config file profile and then overridden by matching environment variables. Access via settings.runtime to get the fully merged result.

Attributes:

Back to top