This project demonstrates the use of Harness Feature Flags in a Python application. It fetches client data based on source IP and interacts with the Harness Feature Flags API to play with feature flags and variations.
- Python 3.11 or higher
- Docker (if you intend to run the application inside a container)
- Clone the repository:
git clone https://github.com/gacerioni/python_harness_feature_flags_play.git
cd python_harness_feature_flags_play
- (Optional) Create a virtual environment:
python3 -m venv venv
source venv/bin/activate
- Install the required packages:
pip install -r requirements.txt
Execute the main script:
python3 main.py
- Build the Docker image:
docker build -t harness-feature-flags-python:v0.0.1 .
- Run the Docker container:
docker run -it -e FF_API_KEY=your_api_key -e FF_BASE_URL=your_base_url -e FF_EVENTS_URL=your_events_url -e FF_IP_INFO_URL=your_ip_info_url -e FF_CLIENT_ID=your_client_id -e FF_CLIENT_NAME=your_client_name harness-feature-flags-python:v0.0.1
Replace the placeholders (your_api_key
, your_base_url
, etc.) with your actual values. If you do not provide them, it will use default values configured in the code (since this is meant to be a Demo).
You can override the default configuration by setting the following environment variables:
FF_API_KEY
: Your Harness Feature Flags API key.FF_BASE_URL
: The base URL for the Harness Feature Flags API.FF_EVENTS_URL
: The events URL for the Harness Feature Flags API.FF_IP_INFO_URL
: The URL to fetch IP information.FF_CLIENT_ID
: The client ID for the Harness Feature Flags.FF_CLIENT_NAME
: The client name for the Harness Feature Flags.
For any questions or feedback, please reach out to:
This project is licensed under the MIT License. See the LICENSE
file for details.