# Configuration

## Supported config formats

- YAML (`.yml`, `.yaml`)
- TOML (`.toml`)
- JSON (`.json`)

## Environment variables

- `OMNI_SDK_CONFIG`: explicit config file path.
- `OMNI_SERVICE_ACCOUNT_KEY`: service-account credential.
- `SIDERO_SERVICE_ACCOUNT_KEY`: fallback service-account alias.

## State persistence

The SDK stores persistent preferences in SQLite (`state.db`):

- `default_instance`
- `default_cluster`
- per-instance cluster preferences
- talos wrapper preferences (`talos.default_cluster`, per-instance talosconfig path)
- command history (redacted, capped at 2000)
- HTTP cache entries

By default, `state.db` is created next to the active config file. Override with `state_path=`.

## Programmatic config

You can pass config as a dict:

```python
from omni import OmniClient

client = OmniClient(
    config={
        "default_instance": "lab",
        "instances": {
            "lab": {
                "url": "https://lab-omni.example",
                "verify_tls": True,
            }
        },
    }
)
```

## Global singleton helpers

```python
from omni import configure, get_sync_client, set_default_cluster

configure(config_path="./config.yml")
client = get_sync_client(instance="prod")
set_default_cluster("cluster-a")
```
