Enhance environment variable handling in start_services.py

- Added load_dotenv() to load environment variables from the .env file, ensuring that COMPOSE_PROFILES is retrieved from the environment.
- Updated the is_supabase_enabled() function to check for 'supabase' in the environment variable instead of directly from the .env file.
- Improved the documentation to clarify the reliance on environment variables for service configuration.
This commit is contained in:
Yury Kossakovsky
2025-05-22 11:39:11 -06:00
parent 394e4669eb
commit a461b783b9

View File

@@ -14,12 +14,12 @@ import time
import argparse
import platform
import sys
from dotenv import dotenv_values
from dotenv import dotenv_values, load_dotenv
def is_supabase_enabled():
"""Check if 'supabase' is in COMPOSE_PROFILES in .env file."""
env_values = dotenv_values(".env")
compose_profiles = env_values.get("COMPOSE_PROFILES", "")
"""Check if 'supabase' is in COMPOSE_PROFILES in the environment."""
# Relies on load_dotenv() being called in main()
compose_profiles = os.environ.get("COMPOSE_PROFILES", "")
return "supabase" in compose_profiles.split(',')
def run_command(cmd, cwd=None):
@@ -230,6 +230,8 @@ def check_and_fix_docker_compose_for_searxng():
print(f"Error checking/modifying docker-compose.yml for SearXNG: {e}")
def main():
load_dotenv(".env") # Load/Reload .env into os.environ
if is_supabase_enabled():
clone_supabase_repo()
prepare_supabase_env()