FlagForge CLI
#python#automation#microsaas
Di' addio alle fatture da 200 $/utente di LaunchDarkly. FlagForge CLI è un motore in Go pronto per la produzione e self-hosted, che offre feature flag con latenza sub-millisecondo, remote config e canary rollout. Include SQLite embedded, zero dipendenze da DB esterni, kill-switch istantanei, audit logging e configurazioni Docker multi-arch.
Leggi l'approfondimento tecnicoBasta Tasse SaaS: Feature Flag Self-Hosted con FlagForge CLImain.pymain.py — estratto d'esempio nello stile del tool
#!/usr/bin/env python3
"""
FlagForge CLI - Production-ready, self-hosted feature flag and remote config engine.
FlagForge provides sub-millisecond flag evaluation, canary rollouts, and instant
kill-switches backed by an embedded SQLite engine with zero external dependencies.
Features:
- Sub-millisecond flag evaluation via embedded local SQLite cache
- Dynamic remote configuration and percentage-based canary rollouts
- Instant emergency kill-switches and automated circuit breaking
- Immutable local audit logging and multi-environment targeting
- Zero-dependency, self-contained architecture for minimal overhead
Usage:
$ flagforge serve --config /etc/flagforge.toml
$ flagforge evaluate --flag user-beta-v2 --context '{"user_id": 42}'
$ flagforge killswitch --flag payment-gateway-v2 --enable
"""
from __future__ import annotations
import enum
import json
import logging
import sqlite3
import time
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
logger = logging.getLogger("flagforge")
class FlagType(str, enum.Enum):
"""Supported feature flag dynamic value evaluation types."""
BOOLEAN = "boolean"
MULTIVARIATE = "multivariate"
REMOTE_CONFIG = "remote_config"
CANARY = "canary"
@dataclass(frozen=True)
class EvaluationContext:
"""Context parameters evaluated against targeting rules."""
entity_id: str
attributes: Dict[str, Any] = field(default_factory=dict)
class FlagEngine:
"""Core flag evaluation engine backed by embedded storage."""
def __init__(self, db_path: Union[str, Path] = ":memory:") -> None:
self.db_path = str(db_path)
# ... the full file ships with your download