| | import os |
| | from cryptography.fernet import Fernet |
| | from dotenv import load_dotenv |
| | load_dotenv() |
| |
|
| | session_keys = {} |
| |
|
| | DEFAULT_KEYS = { |
| | "OPENAI_API_KEY": os.getenv("OPENAI_API_KEY"), |
| | "NEBIUS_API_KEY": os.getenv("NEBIUS_API_KEY"), |
| | } |
| |
|
| |
|
| | ENV_PATH = ".env" |
| | CryptographyKey = os.getenv("CryptographyKey") |
| | if not CryptographyKey: |
| | key = Fernet.generate_key().decode() |
| | CryptographyKey = key |
| |
|
| | |
| | with open(ENV_PATH, "a") as f: |
| | f.write(f"\nCryptographyKey={CryptographyKey}\n") |
| |
|
| | print("β
CryptographyKey added to .env") |
| | else: |
| | print("π CryptographyKey already exists") |
| |
|
| |
|
| | load_dotenv(dotenv_path=ENV_PATH) |
| | CryptographyKey = os.getenv("CryptographyKey") |