Deprecate legacy feature flags, use ALWRITY_ENABLED_FEATURES only
- Remove fallback to ALWRITY_FEATURE_PROFILE, ALWRITY_ROUTER_PROFILE - Primary env var is now ALWRITY_ENABLED_FEATURES (backend) - Primary env var is REACT_APP_ENABLED_FEATURES (frontend) - Add deprecation comments to all get_enabled_features() functions - Update demoMode.ts with clear deprecation notes Usage: ALWRITY_ENABLED_FEATURES=podcast # Podcast only ALWRITY_ENABLED_FEATURES=all # All features (default)
This commit is contained in:
@@ -83,17 +83,16 @@ class RouterManager:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_enabled_features() -> set:
|
def get_enabled_features() -> set:
|
||||||
"""Get enabled features from environment variable.
|
"""Get enabled features from ALWRITY_ENABLED_FEATURES env var.
|
||||||
|
|
||||||
ALWRITY_ENABLED_FEATURES can be:
|
Values:
|
||||||
- "all" - enable all features (default)
|
- "all" - enable all features (default)
|
||||||
- comma-separated list: "podcast,blog-writer,youtube"
|
- comma-separated: "podcast,blog-writer,youtube"
|
||||||
- single feature: "podcast"
|
- single feature: "podcast"
|
||||||
|
|
||||||
|
DEPRECATED: ALWRITY_FEATURE_PROFILE, ALWRITY_ROUTER_PROFILE, ALWRITY_FEATURE_TO_ENABLE
|
||||||
"""
|
"""
|
||||||
env_value = os.getenv(
|
env_value = os.getenv("ALWRITY_ENABLED_FEATURES", "all").strip().lower()
|
||||||
"ALWRITY_ENABLED_FEATURES",
|
|
||||||
os.getenv("ALWRITY_FEATURE_PROFILE", os.getenv("ALWRITY_ROUTER_PROFILE", "all"))
|
|
||||||
).strip().lower()
|
|
||||||
|
|
||||||
if not env_value or env_value == "all":
|
if not env_value or env_value == "all":
|
||||||
return {"all"}
|
return {"all"}
|
||||||
|
|||||||
@@ -60,17 +60,16 @@ def _env_flag_enabled(*env_names: str) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def get_enabled_features() -> set:
|
def get_enabled_features() -> set:
|
||||||
"""Get enabled features from environment variable.
|
"""Get enabled features from ALWRITY_ENABLED_FEATURES env var.
|
||||||
|
|
||||||
ALWRITY_ENABLED_FEATURES can be:
|
Values:
|
||||||
- "all" - enable all features (default)
|
- "all" - enable all features (default)
|
||||||
- comma-separated list: "podcast,core"
|
- comma-separated: "podcast,core"
|
||||||
- single feature: "podcast"
|
- single feature: "podcast"
|
||||||
|
|
||||||
|
DEPRECATED: ALWRITY_FEATURE_PROFILE, ALWRITY_ROUTER_PROFILE, ALWRITY_FEATURE_TO_ENABLE
|
||||||
"""
|
"""
|
||||||
env_value = os.getenv(
|
env_value = os.getenv("ALWRITY_ENABLED_FEATURES", "all").strip().lower()
|
||||||
"ALWRITY_ENABLED_FEATURES",
|
|
||||||
os.getenv("ALWRITY_FEATURE_PROFILE", os.getenv("ALWRITY_ROUTER_PROFILE", "all"))
|
|
||||||
).strip().lower()
|
|
||||||
|
|
||||||
if not env_value or env_value == "all":
|
if not env_value or env_value == "all":
|
||||||
return {"all"}
|
return {"all"}
|
||||||
|
|||||||
@@ -27,17 +27,16 @@ LINGUISTIC_REQUIRED_FEATURES = {"content_planning", "strategy_copilot", "faceboo
|
|||||||
|
|
||||||
|
|
||||||
def get_enabled_features() -> set:
|
def get_enabled_features() -> set:
|
||||||
"""Get enabled features from environment variable.
|
"""Get enabled features from ALWRITY_ENABLED_FEATURES env var.
|
||||||
|
|
||||||
ALWRITY_ENABLED_FEATURES can be:
|
Values:
|
||||||
- "all" - enable all features (default)
|
- "all" - enable all features (default)
|
||||||
- comma-separated list: "podcast,blog-writer,youtube"
|
- comma-separated: "podcast,blog-writer,youtube"
|
||||||
- single feature: "podcast"
|
- single feature: "podcast"
|
||||||
|
|
||||||
|
DEPRECATED: ALWRITY_FEATURE_PROFILE, ALWRITY_ROUTER_PROFILE, ALWRITY_FEATURE_TO_ENABLE
|
||||||
"""
|
"""
|
||||||
env_value = os.getenv(
|
env_value = os.getenv("ALWRITY_ENABLED_FEATURES", "all").strip().lower()
|
||||||
"ALWRITY_ENABLED_FEATURES",
|
|
||||||
os.getenv("ALWRITY_FEATURE_PROFILE", os.getenv("ALWRITY_ROUTER_PROFILE", "all"))
|
|
||||||
).strip().lower()
|
|
||||||
|
|
||||||
if not env_value or env_value == "all":
|
if not env_value or env_value == "all":
|
||||||
return {"all"}
|
return {"all"}
|
||||||
@@ -46,7 +45,7 @@ def get_enabled_features() -> set:
|
|||||||
|
|
||||||
|
|
||||||
def get_active_profile() -> str:
|
def get_active_profile() -> str:
|
||||||
"""Legacy function - returns primary profile for backwards compatibility."""
|
"""Legacy function - use get_enabled_features() instead."""
|
||||||
enabled = get_enabled_features()
|
enabled = get_enabled_features()
|
||||||
if "all" in enabled:
|
if "all" in enabled:
|
||||||
return "all"
|
return "all"
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
/**
|
/**
|
||||||
* Consolidated feature mode detection utilities.
|
* Consolidated feature mode detection utilities.
|
||||||
*
|
*
|
||||||
* Uses ALWRITY_ENABLED_FEATURES (backend) / REACT_APP_ENABLED_FEATURES (frontend)
|
* Primary: REACT_APP_ENABLED_FEATURES (format: "all" or "podcast,core")
|
||||||
* Format: "all" or comma-separated features: "podcast,core"
|
*
|
||||||
|
* DEPRECATED (fallback order):
|
||||||
|
* - REACT_APP_APP_MODE
|
||||||
|
* - REACT_APP_DEMO_MODE
|
||||||
|
* - REACT_APP_PODCAST_ONLY_DEMO_MODE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const ENABLED_FEATURES_STORAGE_KEYS = [
|
const ENABLED_FEATURES_STORAGE_KEYS = [
|
||||||
|
'enabled_features', // Primary
|
||||||
'app_mode',
|
'app_mode',
|
||||||
'enabled_features',
|
|
||||||
'demo_mode',
|
'demo_mode',
|
||||||
'podcast_only_demo_mode',
|
'podcast_only_demo_mode',
|
||||||
];
|
];
|
||||||
|
|
||||||
const ENABLED_FEATURES_ENV_KEYS = [
|
const ENABLED_FEATURES_ENV_KEYS = [
|
||||||
'REACT_APP_ENABLED_FEATURES',
|
'REACT_APP_ENABLED_FEATURES', // Primary - use this!
|
||||||
'REACT_APP_APP_MODE',
|
'REACT_APP_APP_MODE', // DEPRECATED
|
||||||
'REACT_APP_DEMO_MODE',
|
'REACT_APP_DEMO_MODE', // DEPRECATED
|
||||||
'REACT_APP_PODCAST_ONLY_DEMO_MODE',
|
'REACT_APP_PODCAST_ONLY_DEMO_MODE', // DEPRECATED
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user