Spaces:
Paused
Paused
File size: 981 Bytes
918bdb4 2004c79 3b9a6b5 918bdb4 3b9a6b5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import os
import importlib.util
from utils.logging_config import setup_logging, get_logger
# Initialize logging
setup_logging()
logger = get_logger(__name__)
### SECRETS ###
def load_secrets(secrets_file: str):
"""
Load secrets from Python file into environment variables.
Args:
secrets_file (str): Path to the Python file containing secrets
Returns:
bool: True if secrets were loaded successfully
"""
try:
# Import secrets from the specified file
spec = importlib.util.spec_from_file_location("secrets", secrets_file)
secrets = importlib.util.module_from_spec(spec)
spec.loader.exec_module(secrets)
# Set environment variables
os.environ["NEBIUS_API_KEY"] = secrets.NEBIUS_API_KEY
os.environ["NEBIUS_MODEL"] = secrets.NEBIUS_MODEL
return True
except Exception as e:
logger.error(f"Failed to load secrets from {secrets_file}: {str(e)}")
return False
|