# Config (TOML and view config)

## TOML credentials

Create a TOML file in your working directory (e.g. `cog-sail.toml` or `config.toml`):

```toml
[cognite]
project = "<cdf-project>"
client_id = "<client-id>"
client_secret = "<client-secret>"
```

Optional fields (depending on your login flow):

```toml
[cognite]
tenant_id = "<tenant-id>"
cdf_cluster = "<cdf-cluster>"   # e.g. "api", "westeurope-1"
login_flow = "client_credentials"
```

Load the client:

```python
from cognite_data_quality import load_cognite_client_from_toml

client = load_cognite_client_from_toml("cog-sail.toml")
```

Same pattern as pygen: one TOML per environment or project.

## View config (YAML)

View configs live next to your SHACL rules (e.g. under `config/environments/<env>/views/`). Each YAML file describes one view: data model, SHACL file, partition settings, and optional records config. Example structure:

- `settings.yaml` – environment settings (records stream, workflow prefix, etc.)
- `views/smallboat.yaml`, `views/largeboat.yaml` – view-specific config (datamodel, SHACL rules, partition field)

When you call `deploy_validation_infrastructure(settings_path=..., views_dir=...)`, the package reads all view YAMLs from `views_dir` and deploys workflows and triggers accordingly. When you call `run_validation(rules_path="path/to/view.yaml", rules_format="yaml")`, datamodel and instance space are taken from that YAML.

See [Rule sources](../usage/rule_sources.md) and [SHACL and CDF data models](../usage/shacl_cdf_data_models.md) for how rules and views interact.
