> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# configcat/scan-repository

This Orb's responsibility is to discover ConfigCat feature flag usages in your source code and to upload them to ConfigCat.


## Jobs

### scan

Find code references to ConfigCat feature flags or settings in your source code.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `alias-patterns` | string |  | Comma delimited list of custom regex patterns used to search for additional aliases. |
| `api-host` | string | api.configcat.com | ConfigCat Management API host. |
| `api-pass` | env_var_name | CONFIGCAT_API_PASS | ConfigCat Management API basic authentication password. |
| `api-user` | env_var_name | CONFIGCAT_API_USER | ConfigCat Management API basic authentication username. |
| `commit-url-template` | string |  | Template url used to generate VCS commit links. Available template parameters: commitHash. Example: https://github.com/my/repo/commit/{commitHash} |
| `config-id` | string |  | ID of the ConfigCat config to scan against. |
| `exclude-keys` | string |  | List of feature flag keys that must be excluded from the scan report. |
| `file-url-template` | string |  | Template url used to generate VCS file links. Available template parameters: commitHash, filePath, lineNumber. Example: https://github.com/my/repo/blob/{commitHash}/{filePath}#L{lineNumber} |
| `line-count` | integer | 4 | Context line count before and after the reference line (min: 1, max: 10) |
| `sub-folder` | string |  | Sub-folder to scan, relative to the repository root folder. |
| `timeout` | integer | 1800 | Scan timeout in seconds (default: 1800, min: 60) |
| `usage-patterns` | string |  | Comma delimited list of custom regex patterns that describe additional feature flag key usages. |
| `verbose` | boolean | false | Turns on detailed logging. |

## Examples

### complex

Executes the scan job with custom parameters.


```yaml
version: '2.1'
orbs:
  configcat: configcat/scan-repository@1.11.1
workflows:
  main:
    jobs:
      - configcat/scan:
          alias-patterns: (\w+) = :CC_KEY,const (\w+) = feature_flags\.enabled\(:CC_KEY\)
          commit-url-template: https://github.com/my/repo/commit/{commitHash}
          config-id: PASTE-YOUR-CONFIG-ID-HERE
          exclude-keys: |
            flag_key_to_exclue_1 flag_key_to_exclue_2
          file-url-template: >-
            https://github.com/my/repo/blob/{commitHash}/{filePath}#L{lineNumber}
          line-count: 3
          sub-folder: src
          timeout: 2000
          usage-patterns: feature_flags\.enabled\(:CC_KEY\)
          verbose: true
```

### simple

Executes the scan job with default parameters.


```yaml
version: '2.1'
orbs:
  configcat: configcat/scan-repository@1.11.1
workflows:
  main:
    jobs:
      - configcat/scan:
          config-id: PASTE-YOUR-CONFIG-ID-HERE
```