# Configuration

Every connector option is a WordPress `option`. Most are seeded with
safe defaults on first activation and managed remotely by
admin.seekmodo.com via the `tenant.snapshot` pull on a 5-min cadence
(see [`PLATFORM_NOTES.md`](PLATFORM_NOTES.md) for cache caveats).

## Options reference

| Option | Default | Scope | Notes |
|---|---|---|---|
| `seekmodo_wp_gateway_url` | `https://mcp.seekmodo.com` | local | Gateway base URL. Rarely changed; overridable for staging/local-dev. |
| `seekmodo_wp_tenant_id` | _empty_ | local, paired | Set by **Connect to Seekmodo** flow. Re-run `wp seekmodo connect` to rotate. |
| `seekmodo_wp_shared_secret` | _empty_ | local, paired | HMAC-SHA256 secret. Treated as sensitive — masked in the admin UI. |
| `seekmodo_wp_mode` | `off` | local, remote-overridable | One of `off|shadow|active|enforce`. `active` is the self-tuning recommendation. |
| `seekmodo_wp_auto_promote` | `true` | remote | When true and mode is `active`, the auto-promoter manages shadow ↔ enforce transitions. |
| `seekmodo_wp_indexable_post_types` | _auto_ | local + filter | Defaults to posts + pages + every public CPT. Override via the `seekmodo_indexable_post_types` filter or this option. |
| `seekmodo_wp_storefront_host` | `home_url()` host | remote | The canonical storefront host this tenant is locked to. See "Multi-environment installs" in the top-level README. |
| `seekmodo_wp_health_metrics` | `{}` | local | Auto-promoter's rolling p95 / 5xx / fallback gauges. Reset by `wp seekmodo health-reset`. |
| `seekmodo_wp_breaker_state` | `{state: closed}` | local | Circuit breaker state. Closed by default; opens for 60s after 5 consecutive 5xx within 30s. |
| `seekmodo_wp_indexer_cursor` | `null` | local | Resume cursor for partial reindexes. Cleared on `wp seekmodo index --full`. |
| `seekmodo_wp_schema_version` | `1` | local | Bumped by the indexer when document shape changes; triggers an auto-promote of the next delta to full. |

## Filters

| Filter | When | Purpose |
|---|---|---|
| `seekmodo_indexable_post_types` | indexer + search swap | Mutate the list of post types that are searched & indexed. Default: `array_unique(['post', 'page', ...get_post_types(['public' => true, '_builtin' => false])])`. |
| `seekmodo_search_params` | every gateway search call | Mutate the `$params` array before it's sent. Common use: add per-vertical surface tags, override page size. |
| `seekmodo_indexer_doc` | per-doc, both verticals | Mutate the doc shape pushed to the gateway. The 2nd arg is the post / product object. |
| `seekmodo_breaker_thresholds` | breaker init | Override the 5-in-30s rolling window. |
| `seekmodo_disable_storefront_host_lock` | every domain-lock check | Return true to bypass the canonical-host check. Use only for blue/green deploys behind a CDN. |

## Where each option is authoritative

The default is **local**: the WordPress `wp_options` row wins.

The `tenant.snapshot` pull from admin.seekmodo.com overrides a small
subset (mode, auto_promote, storefront_host, breaker_thresholds) so an
operator can flip a flag from admin.seekmodo.com without SSH'ing into
each tenant. Locally-mutated options are restored from `tenant.snapshot`
on every successful pull, so the source of truth for those keys is
admin.seekmodo.com — manual `wp option update` will be reverted within
5 minutes.

## Constants (advanced)

The plugin honors two PHP constants for ops use:

```php
// wp-config.php
define('SEEKMODO_WP_GATEWAY_URL', 'https://mcp.seekmodo.test');
define('SEEKMODO_WP_DISABLE', true);
```

`SEEKMODO_WP_DISABLE` is a kill switch that short-circuits every
gateway-talking entry to `null` (same code path as `MODE=off`). Use
during incident response — it survives plugin updates / reactivations.
