Skip to main content
Version: Config V1 (legacy)

CircleCI Orb - Scan your source code for feature flags

This section describes how to use ConfigCat's CircleCI Orb to automatically scan your source code for feature flag and setting usages and upload the found code references to ConfigCat. You can find more information about CircleCI Orbs here.


  1. Create a new ConfigCat Management API credential and store its values in CircleCI Environment Variables with the following names: CONFIGCAT_API_USER, CONFIGCAT_API_PASS.

    CircleCI Orb secrets
  2. Get your selected Config's ID.

  3. Create a new CircleCI YAML config in your repository under the .circleci folder, and put the following snippet into it. Don't forget to replace the PASTE-YOUR-CONFIG-ID-HERE value with your actual Config ID.

    version: 2.1

    configcat: configcat/scan-[email protected]

    - configcat/scan:
    config-id: PASTE-YOUR-CONFIG-ID-HERE # required
    file-url-template: '{commitHash}/{filePath}#L{lineNumber}' # optional
    commit-url-template: '{commitHash}' # optional
    # line-count: 3 # optional
    # sub-folder: 'src' # optional
    # exclude-keys: > # optional
    # flag_key_to_exclue_1
    # flag_key_to_exclue_2
    # alias-patterns: (\w+) = :CC_KEY,const (\w+) = feature_flags\.enabled\(:CC_KEY\) # optional
    # verbose: true # optional
  4. Commit & push your changes.

The above example configures a workflow that executes the scan and code reference upload on every git push event. Scan reports are uploaded for each branch of your repository that triggers the workflow.

Available Options

config-idID of the ConfigCat config to scan against.
api-hostConfigCat Management API
api-userName of the environment variable where the ConfigCat Management API basic authentication username is stored.CONFIGCAT_API_USER
api-passName of the environment variable where the ConfigCat Management API basic authentication password is stored.CONFIGCAT_API_PASS
file-url-templateTemplate url used to generate VCS file links. Available template parameters: commitHash, filePath, lineNumber. Example:{commitHash}/{filePath}#L{lineNumber}
commit-url-templateTemplate url used to generate VCS commit links. Available template parameters: commitHash. Example:{commitHash}
line-countContext line count before and after the reference line. (min: 1, max: 10)4
sub-folderSub-folder to scan, relative to the repository root folder.
exclude-keysList of feature flag keys that must be excluded from the scan report.
alias-patternsComma delimited list of custom regex patterns used to search for additional aliases.
verboseTurns on detailed logging.false