voicepeak_api/config/settings.py

32 lines
834 B
Python

import os
from dotenv import load_dotenv
load_dotenv()
class Config:
VOICEPEAK_PATH = os.getenv('VOICEPEAK_PATH')
PROJECT_PATH = os.getenv('PROJECT_PATH')
ERROR_WEBHOOK_URL = os.getenv('ERROR_WEBHOOK_URL')
@classmethod
def init_app(cls, app):
app.logger.info(f"VOICEPEAK_PATH: {cls.VOICEPEAK_PATH}")
app.logger.info(f"PROJECT_PATH: {cls.PROJECT_PATH}")
app.logger.info(f"ERROR_WEBHOOK_URL: {'Set' if cls.ERROR_WEBHOOK_URL else 'Not set'}")
class DevelopmentConfig(Config):
DEBUG = True
ENV = 'development'
class ProductionConfig(Config):
DEBUG = False
ENV = 'production'
config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'default': ProductionConfig
}
def get_config():
return config[os.getenv('FLASK_ENV', 'production')]