premier commit

This commit is contained in:
Vincent BENOIT committed 2022-10-04 15:02:50 +02:00
1 parent b525495612
commit 10de8153aa
13 files changed
+700

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
#
# @author: vincent.benoit@benserv.fr
# @brief: Flask Config classes
import os
import datetime
class BaseConfig(object):
PROJECT = "configurateur"
# Get app root path, also can use flask.root_path.
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DEBUG = False
TESTING = False
FLASK_ENV = 'production'
ADMINS = ['vincent.benoit@benserv.fr']
LOG_FOLDER = os.path.join(os.getcwd(), 'log')
SECRET_KEY = "d]omg;<*|uHfs}ogN=dk_$YW"
# Setup the Flask-JWT-Extended extension
JWT_SECRET_KEY = "xbNNvwHCY*cN,)Yq;A,e(]|P"
JWT_COOKIE_SECURE = False
JWT_TOKEN_LOCATION = ["cookies"]
JWT_ACCESS_TOKEN_EXPIRES = datetime.timedelta(minutes=30)
DELTA = datetime.timedelta(minutes=20) # in minutes
# Controls if Cross Site Request Forgery (CSRF) protection is enabled when using cookies
# This should always be True in production
JWT_COOKIE_CSRF_PROTECT = True
JWT_CSRF_IN_COOKIES = True
STATIC_FOLDER = os.path.join(os.getcwd(), 'static')
UPLOAD_FOLDER = STATIC_FOLDER + '/upload'
DOWNLOAD_FOLDER = STATIC_FOLDER + '/download'
ALLOWED_EXTENSIONS = {'json', 'tar', 'txt'}
MAX_CONTENT_LENGTH = 200 * 1024 * 1024 # 100 megabytes
DB_PATH = os.path.join(os.getcwd(), 'db.json')
class DefaultConfig(BaseConfig):
DEBUG = True
TESTING = True
FLASK_ENV = 'development'
SECRET_KEY = "secretkey1"
# Setup the Flask-JWT-Extended extension
JWT_SECRET_KEY = "secretkeyjwt1"
JWT_ACCESS_TOKEN_EXPIRES = datetime.timedelta(minutes=10)
DELTA = datetime.timedelta(minutes=5) # in minutes
class ProdConfig(BaseConfig):
ROOT_BASE_FOLDER = "/opt"
# Log Folder path
LOG_FOLDER = os.path.join("/var/log", BaseConfig.PROJECT)