diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b750ee4..85244db6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Breaking Changes + +- Local configuration directory renamed from `~/.galileo` to `~/.splunk`. The override environment variable is now `SPLUNK_AO_HOME_DIR` (previously `GALILEO_HOME_DIR`). + ## [0.2.1] - 2026-08-07 ### Fixed diff --git a/splunk-ao-migration-tool/README.md b/splunk-ao-migration-tool/README.md index 250c0f95..88d800b7 100644 --- a/splunk-ao-migration-tool/README.md +++ b/splunk-ao-migration-tool/README.md @@ -280,6 +280,7 @@ All `GALILEO_*` environment variables are renamed to `SPLUNK_AO_*`. This is a ** | `GALILEO_DEFAULT_SCORER_MODEL` | `SPLUNK_AO_DEFAULT_SCORER_MODEL` | | `GALILEO_DEFAULT_SCORER_JUDGES` | `SPLUNK_AO_DEFAULT_SCORER_JUDGES` | | `GALILEO_CODE_VALIDATION_*` (4 vars) | `SPLUNK_AO_CODE_VALIDATION_*` | +| `GALILEO_HOME_DIR` | `SPLUNK_AO_HOME_DIR` | ¹ `GALILEO_API_URL` was not a user-facing env var in `galileo-python` — it was an implicit Pydantic settings field on `galileo-core`'s `GalileoConfig`. `SPLUNK_AO_API_URL` is its effective rename and is explicitly bridged in `SplunkAOConfig._bridge_env_vars()`. @@ -340,16 +341,19 @@ The `GalileoScorers` enum has been removed entirely. Migrate to `SplunkAOEvaluat + scorer = SplunkAOEvaluators.completeness ``` -### 5.3 On-Disk Config File +### 5.3 On-Disk Config File and Directory On logout or reset, `splunk-ao-python` writes a non-secret debug snapshot to -`~/.galileo/splunk-ao-config.json`. The directory `~/.galileo/` is inherited -from `galileo-core` and unchanged. +`~/.splunk/splunk-ao-config.json`. Both the directory (`~/.splunk/`, was +`~/.galileo/`) and the filename (`splunk-ao-config.json`, was +`galileo-python-config.json`) have changed. This file is never read back and has no effect on authentication or config resolution. If you have an existing `~/.galileo/galileo-python-config.json` from `galileo-python`, it can be deleted at leisure or simply ignored. +The directory can be overridden via `SPLUNK_AO_HOME_DIR` (previously `GALILEO_HOME_DIR`). + --- ## 6. HTTP Tracing Headers diff --git a/src/splunk_ao/config.py b/src/splunk_ao/config.py index bf002819..c145e250 100644 --- a/src/splunk_ao/config.py +++ b/src/splunk_ao/config.py @@ -2,10 +2,11 @@ # We need to ignore syntax errors until https://github.com/python/mypy/issues/17535 is resolved. import os from collections.abc import Iterator -from typing import Any, ClassVar, Optional +from pathlib import Path +from typing import Any, ClassVar, Optional, Union from httpx import Response -from pydantic import SecretStr, ValidationInfo, field_validator, model_validator +from pydantic import Field, SecretStr, ValidationInfo, field_validator, model_validator from pydantic_core import Url from galileo_core.constants.request_method import RequestMethod @@ -64,18 +65,35 @@ def stream_request(self, method: RequestMethod, path: str, *args: Any, **kwargs: ("SPLUNK_AO_USERNAME", "GALILEO_USERNAME"), ("SPLUNK_AO_PASSWORD", "GALILEO_PASSWORD"), ("SPLUNK_AO_MODE", "GALILEO_MODE"), + ("SPLUNK_AO_HOME_DIR", "GALILEO_HOME_DIR"), ] class SplunkAOConfig(GalileoConfig): """Configure authentication and endpoints for standalone and O11y deployments.""" + home_dir: Path = Field( + default=Path.home() / ".splunk", + validate_default=True, + description="Home directory for Splunk AO.", + exclude=True, + ) # Config file for this project. config_filename: str = "splunk-ao-config.json" console_url: Url = DEFAULT_CONSOLE_URL _instance: ClassVar[Optional["SplunkAOConfig"]] = None + @field_validator("home_dir", mode="before") + @classmethod + def set_home_dir(cls, value: Union[str, Path]) -> Path: + value = Path(value) + if not value.exists(): + value.mkdir(parents=True, exist_ok=True) + if not value.is_dir(): + raise ValueError(f"`SPLUNK_AO_HOME_DIR` {value} is not a directory.") + return value + def reset(self) -> None: # Remove any GALILEO_* keys the bridge injected into os.environ so that # the next get() call re-bridges from scratch with whatever SPLUNK_AO_*