- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
70 lines
2.4 KiB
Python
70 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test simple pour vérifier le chargement des variables d'environnement.
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
def load_environment():
|
|
"""
|
|
Charge les variables d'environnement depuis .env.local.
|
|
Copie de la fonction de agent_v0/main.py pour test isolé.
|
|
"""
|
|
# Chemin vers .env.local dans le répertoire parent
|
|
env_path = Path(__file__).parent / ".env.local"
|
|
|
|
if env_path.exists():
|
|
try:
|
|
# Importer python-dotenv si disponible
|
|
from dotenv import load_dotenv
|
|
load_dotenv(env_path)
|
|
print(f"[test] Variables d'environnement chargées depuis {env_path}")
|
|
except ImportError:
|
|
# Fallback : charger manuellement les variables
|
|
print(f"[test] python-dotenv non disponible, chargement manuel de {env_path}")
|
|
with open(env_path, 'r', encoding='utf-8') as f:
|
|
for line in f:
|
|
line = line.strip()
|
|
if line and not line.startswith('#') and '=' in line:
|
|
key, value = line.split('=', 1)
|
|
# Nettoyer les guillemets si présents
|
|
value = value.strip('"\'')
|
|
os.environ[key.strip()] = value
|
|
except Exception as e:
|
|
print(f"[test] Erreur lors du chargement de {env_path}: {e}")
|
|
else:
|
|
print(f"[test] Fichier .env.local non trouvé à {env_path}")
|
|
|
|
def test_env_loading():
|
|
"""Test que les variables d'environnement sont bien chargées."""
|
|
print("=== Test de chargement des variables d'environnement ===")
|
|
|
|
# Charger les variables d'environnement
|
|
load_environment()
|
|
|
|
# Vérifier les tokens critiques
|
|
tokens_to_check = [
|
|
'RPA_TOKEN_ADMIN',
|
|
'RPA_TOKEN_READONLY',
|
|
'ENCRYPTION_PASSWORD',
|
|
'SECRET_KEY'
|
|
]
|
|
|
|
print("\nVérification des tokens :")
|
|
all_present = True
|
|
|
|
for token in tokens_to_check:
|
|
value = os.environ.get(token)
|
|
if value:
|
|
print(f"✓ {token}: {'*' * 8}...{value[-8:]} (longueur: {len(value)})")
|
|
else:
|
|
print(f"✗ {token}: MANQUANT")
|
|
all_present = False
|
|
|
|
print(f"\nRésultat: {'SUCCÈS' if all_present else 'ÉCHEC'}")
|
|
return all_present
|
|
|
|
if __name__ == "__main__":
|
|
success = test_env_loading()
|
|
exit(0 if success else 1) |