# Configuration

Configure the validator's global settings including custom validation patterns, profanity filters, and service tier preferences.

## Overview

The `configureSettings` function allows you to customize the validator's behavior globally. Settings configured here apply to all validation operations unless overridden by function-specific options.

> **Important:** Call `configureSettings` **before** performing any validation operations to ensure the validator uses your custom configuration.

## Usage

```ts
import { configureSettings } from '@vannizhang/living-atlas-content-validator';

configureSettings(params: ConfigureSettingsParams): void
```

## Parameters

### `additionalPatternsForTitleAndSnippetSearchability`

**Type:** `object` (optional)

Extends the default patterns used to validate searchability of item titles and snippets. These patterns are applied globally to all items. For item-specific patterns, use the `customPatterns` options in the [`validate`](./core-functions/validate.md) function.

| Property | Type | Description |
|----------|------|-------------|
| `matchingPatternsLocation` | `string[]` | Terms recognized as valid location information (e.g., "California", "Europe") |
| `rejectedPatternsLocation` | `string[]` | Terms that should be rejected as location info (e.g., "Unknown Location") |
| `matchingPatternsSource` | `string[]` | Terms recognized as valid data sources (e.g., "NOAA", "USGS") |
| `rejectedPatternsSource` | `string[]` | Terms that should be rejected as source info (e.g., "Unknown Source") |
| `matchingPatternsTopic` | `string[]` | Terms recognized as valid topics (e.g., "Climate Change", "Demographics") |
| `rejectedPatternsTopic` | `string[]` | Terms that should be rejected as topic info (e.g., "Unknown Topic") |
| `matchingPatternsYearVintage` | `string[]` | Terms recognized as valid temporal info (e.g., "2023", "bi-weekly") |
| `rejectedPatternsYearVintage` | `string[]` | Terms that should be rejected as temporal info (e.g., "Unknown Year") |
| `shouldAvoidUsingWordBoundary` | `boolean` | Set to `true` for non-Latin languages where word boundaries don't apply |

### `profanities`

**Type:** `string[]` (optional)

Custom list of words to flag as inappropriate in item metadata. This supplements the default profanity filter.

### `serviceTier`

**Type:** `'dev' | 'prod'` (optional, default: `'prod'`)

Specifies the ArcGIS service tier for helper modules. Only relevant if you're using non-core helper functions.

| Value | Environment | Base URL |
|-------|-------------|----------|
| `'dev'` | Development | `devext.arcgis.com` |
| `'prod'` | Production | `www.arcgis.com` |

> **Note:** Most users can ignore this setting—it doesn't affect core validation logic.

## Example Usage

### Basic Configuration

```js
import { configureSettings } from '@vannizhang/living-atlas-content-validator';

configureSettings({
    additionalPatternsForTitleAndSnippetSearchability: {
        matchingPatternsLocation: ['New York', 'Los Angeles', 'Pacific Northwest'],
        rejectedPatternsLocation: ['Unknown', 'TBD'],
        matchingPatternsSource: ['NOAA', 'Department of Energy', 'CDC'],
        rejectedPatternsSource: ['Unknown', 'N/A'],
        matchingPatternsTopic: ['Climate Change', 'Renewable Energy', 'Public Health'],
        rejectedPatternsTopic: ['Unknown', 'Miscellaneous'],
        matchingPatternsYearVintage: ['bi-weekly', 'monthly', 'quarterly', '2023-2024'],
        rejectedPatternsYearVintage: ['Unknown', 'TBD'],
        shouldAvoidUsingWordBoundary: false
    }
});
```

### Non-English Language Support

```js
configureSettings({
    additionalPatternsForTitleAndSnippetSearchability: {
        matchingPatternsLocation: ['东京', '北京', '上海'],  // Tokyo, Beijing, Shanghai
        matchingPatternsSource: ['国家统计局', '气象局'],     // National Statistics, Weather Bureau
        shouldAvoidUsingWordBoundary: true  // Important for non-Latin scripts
    }
});
```