TelegramAktienBot/api/config.py

56 lines
1.6 KiB
Python
Raw Normal View History

2022-03-13 19:43:24 +00:00
import os
from dotenv import load_dotenv
2022-03-22 10:21:39 +00:00
from schema import BaseResponseSchema
2022-03-17 08:26:25 +00:00
2022-03-13 19:43:24 +00:00
load_dotenv()
class ConfigClass(object):
""" Flask application config """
# Flask settings
SECRET_KEY = os.getenv('SECRET_KEY')
# Flask-SQLAlchemy settings
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://" + \
os.getenv('MYSQL_USER') + ":" + \
os.getenv('MYSQL_PASSWORD') + "@" + \
os.getenv('MYSQL_HOST') + ":" + \
(os.getenv("MYSQL_PORT") or str(3306)) + "/" + \
os.getenv('MYSQL_DATABASE')
SQLALCHEMY_TRACK_MODIFICATIONS = False # Avoids SQLAlchemy warning
SQLALCHEMY_ENGINE_OPTIONS = {
'pool_size': 100,
'pool_recycle': 240 # 4 minutes
}
2022-03-17 08:26:25 +00:00
# openapi/Swagger config
SERVERS = [
{
"name": "Production",
"url": "https://aktienbot.flokaiser.com"
},
{
"name": "Local",
"url": "http://127.0.0.1:5000"
}
]
INFO = {
'description': 'Webengineering 2 | Telegram Aktienbot',
'version': '0.0.1'
# 'termsOfService': 'http://example.com',
# 'contact': {
# 'name': 'API Support',
# 'url': 'http://www.example.com/support',
# 'email': 'support@example.com'
# },
# 'license': {
# 'name': 'Apache 2.0',
# 'url': 'http://www.apache.org/licenses/LICENSE-2.0.html'
# }
}
BASE_RESPONSE_DATA_KEY = "data"
BASE_RESPONSE_SCHEMA = BaseResponseSchema