-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
40 lines (31 loc) · 1.23 KB
/
config.py
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
36
37
38
39
40
import os
from dotenv import load_dotenv
# Load Environment Variables
load_dotenv()
# Define Configuration Settings as a Dictionary
class Config:
# General Settings
DEBUG = os.getenv("DEBUG", False) # Enable Debug Mode if DEBUG=True in .env
TESTING = os.getenv("TESTING", False) # Enable Testing Mode if TESTING=True in .env
# OpenAI API Configuration
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") # Load from the .env file
DEFAULT_MODEL = "text-davinci-003" # Default OpenAI Model to use if not specified
# Database Configuration (If used)
DATABASE_URI = os.getenv("DATABASE_URI") # Load from the .env file if using a database
# Logging Settings
LOGGING_LEVEL = os.getenv("LOGGING_LEVEL", "INFO") # Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
# Define Configurations for Different Environments (If necessary)
class DevelopmentConfig(Config):
DEBUG = True
TESTING = True
class TestingConfig(Config):
TESTING = True
class ProductionConfig(Config):
DEBUG = False
TESTING = False
# Assign configurations based on the environment (OS environment variable)
config = {
"development": DevelopmentConfig,
"testing": TestingConfig,
"production": ProductionConfig,
}