Sign inSign up

configcat/feature-flag-reference-validator

By configcat

•Updated almost 5 years ago

Image
0

10K+

configcat/feature-flag-reference-validator repository overview

⁠Feature Flag reference validator CLI [archived]

This repository has been archived. The project became obsolate after the release of ConfigCat's official CLI⁠.

PyPI Docker version

This CLI utility discovers ConfigCat feature flag usages in your source code and validates them against your feature flags on the ConfigCat Dashboard.

⁠About ConfigCat

Manage features and change your software configuration using ConfigCat feature flags⁠, without the need to re-deploy code. A 10 minute trainable Dashboard⁠ allows even non-technical team members to manage features directly. Deploy anytime, release when confident. Target a specific group of users first with new ideas. Supports A/B/n testing and soft launching. Provides open-source SDKs⁠ for easy integration with any web, mobile or backend application.

⁠Installation

This CLI tool is written in python so you have to have python installed on your system.

  1. Install the The silver searcher⁠ used for source code scanning.
    • Linux
      apt-get install silversearcher-ag
      
    • Windows
      choco install ag
      
  2. Install the reference validator using pip.
    pip install configcat-flag-reference-validator
    
  3. Execute the validator.
    configcat-validator.py [YOUR-CONFIGCAT-SDKKEY] [DIRECTORY-TO-SCAN] 
    
⁠Docker

Pull the configcat/feature-flag-reference-validator docker image to your environment. The image provides an entry point configcat-validator.py to execute the validator.

docker pull configcat/feature-flag-reference-validator

docker run configcat-validator.py [YOUR-CONFIGCAT-SDKKEY] [DIRECTORY-TO-SCAN]

⁠Arguments

NameRequiredDefault valueDescription
configcat_sdk_keyyesN/AThe SDK Key of your ConfigCat project.
search_diryesN/AThe directory to scan for flag references.
-s, --configcat_cdn_servernocdn.configcat.comThe domain name of the ConfigCat CDN where you ConfigCat configuration file is stored.
-f, --fail_on_warningsnofalseSignals an error when the validation fails. By default only warnings are showed.
-v, --verbosenofalseTurns on detailed logging.

⁠Example

The following command will execute a flag reference validation on the ./repo folder and signals a failure when it finds flag key mismatches.

configcat-validator.py \
    [YOUR-CONFIGCAT-SDKKEY] \
    ./repo \
    --fail_on_warnings \
    --verbose

Output:

INFO:configcat.reference_validator.config_fetcher:Fetching the current ConfigCat configuration from cdn.configcat.com.
INFO:configcat.reference_validator.config_fetcher:Successful fetch, 2 settings found: ['key1', 'key2'].
INFO:configcat.reference_validator.reference_finder:Scanning the ./repo directory for ConfigCat setting references.
INFO:configcat.reference_validator.reference_finder:6 references found: {'key1', 'key2', 'key3'}.
WARNING:configcat.reference_validator.reference_validator:Feature flag/Setting keys not found in ConfigCat (but present in source code): {'key3'}.
Exited with code 1

⁠CI Integrations

⁠About ConfigCat

Tag summary

Content type

Image

Digest

Size

22.9 MB

Last updated

almost 5 years ago

docker pull configcat/feature-flag-reference-validator