features.yaml
or features.yml
files but need to initialize version control for them.
Overview
Flipt v2 supports automatic Git repository detection and initialization for existing feature files when using the local storage backend. This addresses the common workflow where you have existing feature flag configurations but no Git repository initialized yet.This is only necessary if you want to pre-populate Flipt with existing feature
data from your local machine.If you are starting fresh or have data synced to
a remote repository then following this guide is not necessary.
Supported File Formats
Flipt v2 supports both YAML file extensions for feature configurations:features.yaml
(recommended)features.yml
Basic Setup Workflow
The typical workflow for initializing a Git repository with existing feature files is:1. Organize Your Feature Files
Create a directory structure with your existing features:2. Initialize Git Repository
Navigate to your flags directory and initialize Git:3. Configure Flipt
Create a Flipt configuration that points to your flags directory:4. Start Flipt Server
Run Flipt pointing to your configuration:Repository Detection
Flipt v2 includes enhanced repository detection logic that can handle:- Normal Git Repositories: Standard repositories created with
git init
(with.git
subdirectory) - Bare Repositories: Repositories managed internally by Flipt (Git files in root directory)
- Automatic Fallback: Graceful handling when repository types are ambiguous
- Detects the repository type
- Creates necessary remote tracking references (
refs/remotes/origin/main
) - Sets up proper branch management for Fliptβs operations
Working Directory Synchronization
When you make changes through the Flipt UI, the system automatically:- Updates the actual
.yaml
files on disk for normal repositories - Maintains backward compatibility with existing bare repository workflows
- Synchronizes changes back to the filesystem
Configuration Examples
Basic Local Storage
Multiple Environments
With Remote Git Repository
You can also combine local storage with remote Git synchronization:Docker Usage
When using Docker, you can initialize the repository in your container build process:Troubleshooting
Repository Does Not Exist Error
If you see this error, ensure that:- Your
path
configuration points to a valid directory - The directory contains your feature files
- Git is properly initialized in the directory
Features Not Loading
Check that:- Your feature files use the correct naming:
features.yaml
orfeatures.yml
- The files are in the correct directory structure
- The YAML syntax is valid
- You added and committed the files at
path
Backward Compatibility
This enhancement is fully backward compatible:- Existing bare repository workflows continue to work unchanged
- All existing functionality is preserved
- Safe fallbacks handle edge cases gracefully