chat / app /utils /load_env.py
ariansyahdedy's picture
Add prompt edit and api key config
f923596
raw
history blame
821 Bytes
from dotenv import load_dotenv
import os
# Load the .env file if the environment is development
ENV = os.getenv("ENV", "production") # Default to production if ENV is not set
if ENV == "development":
print("Environment detected: Development. Loading .env file.")
load_dotenv()
else:
print("Environment detected: Production. Using system environment variables.")
# Access your environment variables
ACCESS_TOKEN = os.getenv("ACCESS_TOKEN")
WHATSAPP_API_URL = os.getenv("WHATSAPP_API_URL")
OPENAI_API = os.getenv("OPENAI_API")
GEMINI_API = os.getenv("GEMINI_API")
CX_CODE = os.getenv("CX_CODE")
CUSTOM_SEARCH_API_KEY = os.getenv("CUSTOM_SEARCH_API_KEY")
# Debugging: Print the retrieved ACCESS_TOKEN (for development only)
# if ENV == "development":
# print(f"ACCESS_TOKEN loaded: {ACCESS_TOKEN}")