Source code for webapp.config

"""Config module for PgConfig webapp."""
import os
import logging

[docs] CURR_PATH = os.path.abspath(os.path.dirname(__file__))
[docs] PROJECT_BASE_PATH = os.path.abspath(os.path.join(CURR_PATH, os.pardir))
[docs] APP_NAME = 'PG Configuration Tracking'
[docs] LOG_FORMAT = '%(levelname)s - %(asctime)s - %(name)s - %(message)s'
[docs] LOGGER = logging.getLogger(__name__)
try:
[docs] LOG_PATH = os.environ['LOG_PATH']
except KeyError: LOG_PATH = PROJECT_BASE_PATH + '/pgconfig_app.log' try:
[docs] APP_DEBUG = os.environ['APP_DEBUG']
except KeyError: APP_DEBUG = True # Required for CSRF protection in Flask, please change to something secret! try:
[docs] APP_SECRET_KEY = os.environ['APP_SECRET_KEY']
except KeyError: ERR_MSG = '\nSECURITY WARNING: To ensure security please set the APP_SECRET_KEY' ERR_MSG += ' environment variable.\n' LOGGER.warning(ERR_MSG) print(ERR_MSG) APP_SECRET_KEY = 'YourApplicationShouldBeServedFreshWithASecureAndSecretKey!'