hawat.config module

This module contains default configurations for Hawat application. One of the classes defined in this module may be passed as argument to hawat.app.create_app_full() factory function to bootstrap Hawat default configurations. These values may be then optionally overwritten by external configuration file and/or additional configuration file defined indirrectly via environment variable. Please refer to the documentation of hawat.app.create_app_full() factory function for more details on this process.

There are following predefined configuration classess available:

hawat.config.ProductionConfig

Default configuration suite for production environments.

hawat.config.DevelopmentConfig

Default configuration suite for development environments.

hawat.config.TestingConfig

Default configuration suite for testing environments.

There is also following constant structure containing mapping of simple configuration names to configuration classess:

CONFIG_MAP

It is used from inside hawat.app.create_app() factory method to pick and apply correct configuration class to application. Please refer to the documentation of hawat.app.create_app() factory function for more details on this process.

hawat.config.CONFIG_MAP = {'default': <class 'hawat.config.ProductionConfig'>, 'development': <class 'hawat.config.DevelopmentConfig'>, 'production': <class 'hawat.config.ProductionConfig'>, 'testing': <class 'hawat.config.TestingConfig'>}

Configuration map for easy mapping of configuration aliases to config objects.

class hawat.config.Config[source]

Bases: object

Base class for default configurations of Hawat application. You are free to extend and customize contents of this class to provide better default values for your particular environment.

The configuration keys must be a valid Flask configuration, and so they must be written in UPPERCASE to be correctly recognized.

APPLICATION_ID = 'mentat'
APPLICATION_NAME = 'Mentat'
BABEL_DEFAULT_LOCALE = 'en'
BABEL_DEFAULT_TIMEZONE = 'UTC'
BABEL_DETECT_LOCALE = True

Custom configuration, make detection of best possible locale optional to enable forcing default.

DEBUG = False
DISABLED_ENDPOINTS = []

List of endpoints disabled on application level.

DISABLE_MAIL_LOGGING = False
EMAIL_ADMINS = ['root@alchemist.cesnet.cz']

List of system administrator emails.

ENABLED_BLUEPRINTS = ['hawat.blueprints.auth', 'hawat.blueprints.auth_api', 'hawat.blueprints.design_bs3', 'hawat.blueprints.devtools', 'hawat.blueprints.changelogs', 'hawat.blueprints.auth_env', 'hawat.blueprints.auth_pwd', 'hawat.blueprints.home', 'hawat.blueprints.reports', 'hawat.blueprints.events', 'hawat.blueprints.detectors', 'hawat.blueprints.hosts', 'hawat.blueprints.timeline', 'hawat.blueprints.dnsr', 'hawat.blueprints.geoip', 'hawat.blueprints.whois', 'hawat.blueprints.performance', 'hawat.blueprints.status', 'hawat.blueprints.dbstatus', 'hawat.blueprints.users', 'hawat.blueprints.groups', 'hawat.blueprints.settings_reporting', 'hawat.blueprints.filters', 'hawat.blueprints.networks']

List of requested application blueprints to be loaded during setup.

ENDPOINT_HOME = 'home.index'

Homepage endpoint.

ENDPOINT_LOGIN = 'auth.login'

Default login view. Users will be redirected to this view in case they are not authenticated, but the authentication is required for the requested endpoint.

ENDPOINT_LOGIN_REDIRECT = 'home.index'

Default redirection endpoint after login.

ENDPOINT_LOGOUT_REDIRECT = 'home.index'

Default redirection endpoint after logout.

HAWAT_CHART_TIMELINE_MAXSTEPS = 200

Maximal number of steps (bars) displayed in timeline chart.

HAWAT_LIMIT_AODS = 20

Limit for number of objects for which to automatically fetch additional data services.

HAWAT_REPORT_FEEDBACK_MAILS = ['root@alchemist.cesnet.cz']

List of system administrator emails, that receive feedback messages for reports.

HAWAT_SEARCH_QUERY_QUOTA = 7

Event search query quota per each user.

ICONS = {'action-add-member': '<i class="fas fa-fw fa-user-plus"></i>', 'action-create': '<i class="fas fa-fw fa-plus-circle"></i>', 'action-create-user': '<i class="fas fa-fw fa-user-plus"></i>', 'action-delete': '<i class="fas fa-fw fa-trash"></i>', 'action-delete-user': '<i class="fas fa-fw fa-user-slash"></i>', 'action-disable': '<i class="fas fa-fw fa-lock"></i>', 'action-disable-user': '<i class="fas fa-fw fa-user-lock"></i>', 'action-download': '<i class="fas fa-fw fa-file-download"></i>', 'action-download-csv': '<i class="fas fa-fw fa-file-csv"></i>', 'action-download-js': '<i class="fab fa-fw fa-js"></i>', 'action-download-svg': '<i class="fas fa-fw fa-file-image"></i>', 'action-download-zip': '<i class="fas fa-fw fa-file-archive"></i>', 'action-enable': '<i class="fas fa-fw fa-unlock"></i>', 'action-enable-user': '<i class="fas fa-fw fa-user-check"></i>', 'action-genkey': '<i class="fas fa-fw fa-key"></i>', 'action-mail': '<i class="fas fa-fw fa-envelope"></i>', 'action-more': '<i class="fas fa-fw fa-cubes"></i>', 'action-rej-member': '<i class="fas fa-fw fa-user-minus"></i>', 'action-reload': '<i class="fas fa-fw fa-sync-alt"></i>', 'action-rem-member': '<i class="fas fa-fw fa-user-times"></i>', 'action-save': '<i class="fas fa-fw fa-save"></i>', 'action-search': '<i class="fas fa-fw fa-search"></i>', 'action-show': '<i class="fas fa-fw fa-eye"></i>', 'action-show-user': '<i class="fas fa-fw fa-user-circle"></i>', 'action-sort': '<i class="fas fa-fw fa-sort"></i>', 'action-sort-asc': '<i class="fas fa-fw fa-sort-up"></i>', 'action-sort-desc': '<i class="fas fa-fw fa-sort-down"></i>', 'action-stop': '<i class="fas fa-fw fa-stop-circle"></i>', 'action-update': '<i class="fas fa-fw fa-edit"></i>', 'action-update-user': '<i class="fas fa-fw fa-user-edit"></i>', 'actions': '<i class="fas fa-fw fa-wrench"></i>', 'ajax-loader': '<i class="fas fa-fw fa-spinner fa-spin fa-4x"></i>', 'alert-danger': '<i class="fas fa-fw fa-exclamation-triangle"></i>', 'alert-info': '<i class="fas fa-fw fa-info-circle"></i>', 'alert-success': '<i class="fas fa-fw fa-check-circle"></i>', 'alert-warning': '<i class="fas fa-fw fa-exclamation-circle"></i>', 'anchor': '<i class="fas fa-fw fa-anchor"></i>', 'avg': '<i class="fas fa-fw fa-dot-circle"></i>', 'backtotop': '<i class="fas fa-fw fa-level-up-alt"></i>', 'calendar': '<i class="fas fa-fw fa-calendar-alt"></i>', 'caret-down': '<i class="fas fa-fw fa-caret-square-down"></i>', 'check': '<i class="fas fa-fw fa-check-square"></i>', 'check_blank': '<i class="far fa-fw fa-square"></i>', 'clock': '<i class="fas fa-fw fa-clock"></i>', 'cnt': '<i class="fas fa-fw fa-hashtag"></i>', 'cog': '<i class="fas fa-fw fa-cog"></i>', 'collapse': '<i class="fas fa-fw fa-angle-down" aria-hidden="true"></i>', 'compress': '<i class="fas fa-fw fa-gift"></i>', 'debug': '<i class="fas fa-fw fa-bug"></i>', 'domain': '<i class="fas fa-fw fa-tag"></i>', 'eventclss': '<i class="fas fa-fw fa-book"></i>', 'expand': '<i class="fas fa-fw fa-angle-left" aria-hidden="true"></i>', 'export': '<i class="fas fa-fw fa-cloud-download"></i>', 'first': '<i class="fas fa-fw fa-angle-double-left"></i>', 'form-error': '<i class="fas fa-fw fa-exclamation-triangle" aria-hidden="true"></i>', 'help': '<i class="fas fa-fw fa-question-circle"></i>', 'import': '<i class="fas fa-fw fa-cloud-upload"></i>', 'item-disabled': '<i class="fas fa-fw fa-toggle-off"></i>', 'item-enabled': '<i class="fas fa-fw fa-toggle-on"></i>', 'ko': '<i class="fas fa-fw fa-times"></i>', 'language': '<i class="fas fa-fw fa-globe"></i>', 'last': '<i class="fas fa-fw fa-angle-double-right" aria-hidden="true"></i>', 'liitem': '<i class="fas fa-li fa-asterisk" aria-hidden="true"></i>', 'list': '<i class="fas fa-fw fa-list-ul"></i>', 'login': '<i class="fas fa-fw fa-sign-in-alt"></i>', 'logout': '<i class="fas fa-fw fa-sign-out-alt"></i>', 'mail': '<i class="fas fa-fw fa-envelope"></i>', 'max': '<i class="fas fa-fw fa-angle-double-up"></i>', 'med': '<i class="fas fa-fw fa-bullseye"></i>', 'min': '<i class="fas fa-fw fa-angle-double-down"></i>', 'missing-icon': '<i class="fas fa-fw fa-question" title="Missing icon"></i>', 'modal-question': '<i class="fas fa-fw fa-question-circle"></i>', 'module-auth-api': '<i class="fas fa-fw fa-id-card-alt"></i>', 'module-auth-dev': '<i class="fas fa-fw fa-id-card-alt"></i>', 'module-auth-env': '<i class="fas fa-fw fa-id-card-alt"></i>', 'module-changelogs': '<i class="fas fa-fw fa-clipboard-list"></i>', 'module-dashboards': '<i class="fas fa-fw fa-tachometer-alt"></i>', 'module-dbstatus': '<i class="fas fa-fw fa-database"></i>', 'module-design': '<i class="fas fa-fw fa-palette"></i>', 'module-detectors': '<i class="fas fa-fw fa-user-secret"></i>', 'module-devtools': '<i class="fas fa-fw fa-bug"></i>', 'module-dnsr': '<i class="fas fa-fw fa-directions"></i>', 'module-events': '<i class="fas fa-fw fa-bell"></i>', 'module-filters': '<i class="fas fa-fw fa-filter"></i>', 'module-geoip': '<i class="fas fa-fw fa-map-marked-alt"></i>', 'module-groups': '<i class="fas fa-fw fa-users"></i>', 'module-help': '<i class="fas fa-fw fa-question-circle"></i>', 'module-home': '<i class="fas fa-fw fa-home"></i>', 'module-hosts': '<i class="fas fa-fw fa-server"></i>', 'module-nerd': '<i class="fas fa-fw fa-certificate"></i>', 'module-networks': '<i class="fas fa-fw fa-sitemap"></i>', 'module-pdnsr': '<i class="fas fa-fw fa-compass"></i>', 'module-performance': '<i class="fas fa-fw fa-chart-bar"></i>', 'module-reports': '<i class="fas fa-fw fa-newspaper"></i>', 'module-settings-reporting': '<i class="fas fa-fw fa-sliders-h"></i>', 'module-skeleton': '<i class="fas fa-fw fa-skull"></i>', 'module-status': '<i class="fas fa-fw fa-heartbeat"></i>', 'module-timeline': '<i class="fas fa-fw fa-chart-line"></i>', 'module-users': '<i class="fas fa-fw fa-user"></i>', 'module-whois': '<i class="fas fa-fw fa-map-signs"></i>', 'mute': '<i class="fas fa-fw fa-volume-off"></i>', 'na': '<i class="fas fa-fw fa-times"></i>', 'next': '<i class="fas fa-fw fa-angle-right"></i>', 'ok': '<i class="fas fa-fw fa-check"></i>', 'playground': '<i class="fas fa-fw fa-gamepad"></i>', 'previous': '<i class="fas fa-fw fa-angle-left"></i>', 'profile': '<i class="fas fa-fw fa-id-card"></i>', 'quicksearch': '<i class="fab fa-fw fa-searchengin"></i>', 'r-s-critical': '<i class="fas fa-fw fa-thermometer-full"></i>', 'r-s-high': '<i class="fas fa-fw fa-thermometer-three-quarters"></i>', 'r-s-low': '<i class="fas fa-fw fa-thermometer-quarter"></i>', 'r-s-medium': '<i class="fas fa-fw fa-thermometer-half"></i>', 'r-s-unknown': '<i class="fas fa-fw fa-thermometer-empty"></i>', 'r-t-extra': '<i class="fas fa-fw fa-file-alt"></i>', 'r-t-summary': '<i class="fas fa-fw fa-archive"></i>', 'redirect': '<i class="fas fa-fw fa-share"></i>', 'reference': '<i class="fas fa-fw fa-external-link-alt"></i>', 'register': '<i class="fas fa-fw fa-user-plus"></i>', 'report-data-filtered': '<i class="fas fa-fw fa-filter"></i>', 'report-data-mailed': '<i class="fas fa-fw fa-envelope"></i>', 'report-data-relapsed': '<i class="fas fa-fw fa-sync-alt"></i>', 'report-data-test': '<i class="fas fa-fw fa-bug"></i>', 'role-admin': '<i class="fas fa-fw fa-user-ninja"></i>', 'role-anonymous': '<i class="fas fa-fw fa-user-secret"></i>', 'role-developer': '<i class="fas fa-fw fa-user-md"></i>', 'role-maintainer': '<i class="fas fa-fw fa-user-tie"></i>', 'role-user': '<i class="fas fa-fw fa-user"></i>', 'search': '<i class="fas fa-fw fa-search"></i>', 'section-administration': '<i class="fas fa-fw fa-cogs"></i>', 'section-dashboards': '<i class="fas fa-fw fa-tachometer-alt"></i>', 'section-development': '<i class="fas fa-fw fa-bug"></i>', 'section-home': '<i class="fas fa-fw fa-home"></i>', 'section-more': '<i class="fas fa-fw fa-puzzle-piece"></i>', 'sortasc': '<i class="fas fa-fw fa-sort-asc"></i>', 'sortdesc': '<i class="fas fa-fw fa-sort-desc"></i>', 'stats': '<i class="fas fa-fw fa-bar-chart"></i>', 'stopwatch': '<i class="fas fa-fw fa-stopwatch"></i>', 'structure': '<i class="fas fa-fw fa-tree"></i>', 'sum': '<i class="fas fa-fw fa-plus"></i>', 'table': '<i class="fas fa-fw fa-table"></i>', 'time-from': '<i class="fas fa-fw fa-hourglass-start"></i>', 'time-to': '<i class="fas fa-fw fa-hourglass-end"></i>', 'unassigned': '<i class="fas fa-fw fa-minus"></i>', 'uncompress': '<span class="fa-layers fa-fw"><i class="fas fa-fw fa-gift"></i><i class="fas fa-fw fa-ban"></i></span>', 'undisclosed': '<i class="fas fa-fw fa-minus"></i>', 'unmute': '<i class="fas fa-fw fa-volume-up"></i>', 'unredirect': '<span class="fa-layers fa-fw"><i class="fas fa-fw fa-share"></i><i class="fas fa-fw fa-ban"></i></span>', 'validate': '<i class="fas fa-fw fa-check-circle"></i>', 'weight': '<i class="fas fa-fw fa-weight"></i>'}
LOGIN_MSGCAT = 'info'

Default message category for messages related to user authentication.

LOG_DEFAULT_LEVEL = 'info'

Default logging level, case insensitive. One of the values DEBUG, INFO, WARNING, ERROR, CRITICAL.

LOG_EMAIL_LEVEL = 'error'

File logging level, case insensitive. One of the values DEBUG, INFO, WARNING, ERROR, CRITICAL.

LOG_FILE_LEVEL = 'info'

File logging level, case insensitive. One of the values DEBUG, INFO, WARNING, ERROR, CRITICAL.

MAIL_DEFAULT_SENDER = 'mentat@alchemist.cesnet.cz'
MAIL_PASSWORD = None
MAIL_PORT = 25
MAIL_SERVER = 'localhost'
MAIL_SUBJECT_PREFIX = '[Mentat]'
MAIL_USERNAME = None
MENU_MAIN_SKELETON = [{'entry_type': 'submenu', 'ident': 'dashboards', 'position': 100, 'title': l'Dashboards', 'resptitle': True, 'icon': 'section-dashboards'}, {'entry_type': 'submenu', 'ident': 'more', 'position': 200, 'title': l'More', 'resptitle': True, 'icon': 'section-more'}, {'entry_type': 'submenu', 'ident': 'admin', 'position': 300, 'authentication': True, 'authorization': ['power'], 'title': l'Administration', 'resptitle': True, 'icon': 'section-administration'}, {'entry_type': 'submenu', 'ident': 'developer', 'position': 400, 'authentication': True, 'authorization': ['developer'], 'title': l'Development', 'resptitle': True, 'icon': 'section-development'}]

Configuration of application menu skeleton.

MIGRATE_DIRECTORY = '/home/buildbot/workers/worker-mentat-py3/mentat-doc/build/lib/hawat/migrations'
MODELS = {'group': <class 'mentat.datatype.sqldb.GroupModel'>, 'item_changelog': <class 'mentat.datatype.sqldb.ItemChangeLogModel'>, 'user': <class 'mentat.datatype.sqldb.UserModel'>}

Models to be used within the application.

ROLES = ['user', 'developer', 'maintainer', 'admin']

List of all valid user roles supported by the application.

SECRET_KEY = 'default-secret-key'
SQLALCHEMY_SETUP_ARGS = {'metadata': MetaData(bind=None), 'model_class': <class 'sqlalchemy.ext.declarative.api.Base'>, 'query_class': <class 'mentat.services.sqlstorage.RetryingQuery'>}
SQLALCHEMY_TRACK_MODIFICATIONS = False
SUPPORTED_LOCALES = {'cs': 'Česky', 'en': 'English'}

List of all languages (locales) supported by the application.

TESTING = False
WTF_CSRF_ENABLED = True
class hawat.config.DevelopmentConfig[source]

Bases: hawat.config.Config

Class containing application configurations for development environment.

DEBUG = True
ENABLED_BLUEPRINTS = ['hawat.blueprints.auth', 'hawat.blueprints.auth_api', 'hawat.blueprints.design_bs3', 'hawat.blueprints.devtools', 'hawat.blueprints.changelogs', 'hawat.blueprints.auth_env', 'hawat.blueprints.auth_dev', 'hawat.blueprints.auth_pwd', 'hawat.blueprints.home', 'hawat.blueprints.reports', 'hawat.blueprints.events', 'hawat.blueprints.detectors', 'hawat.blueprints.hosts', 'hawat.blueprints.timeline', 'hawat.blueprints.dnsr', 'hawat.blueprints.geoip', 'hawat.blueprints.whois', 'hawat.blueprints.performance', 'hawat.blueprints.status', 'hawat.blueprints.dbstatus', 'hawat.blueprints.users', 'hawat.blueprints.groups', 'hawat.blueprints.settings_reporting', 'hawat.blueprints.filters', 'hawat.blueprints.networks']
ENDPOINT_LOGIN = 'auth_dev.login'
LOG_DEFAULT_LEVEL = 'debug'
LOG_FILE_LEVEL = 'debug'
class hawat.config.ProductionConfig[source]

Bases: hawat.config.Config

Class containing application configurations for production environment.

class hawat.config.TestingConfig[source]

Bases: hawat.config.Config

Class containing testing Hawat applications` configurations.

ENABLED_BLUEPRINTS = ['hawat.blueprints.auth', 'hawat.blueprints.auth_api', 'hawat.blueprints.design_bs3', 'hawat.blueprints.devtools', 'hawat.blueprints.changelogs', 'hawat.blueprints.auth_env', 'hawat.blueprints.auth_dev', 'hawat.blueprints.auth_pwd', 'hawat.blueprints.home', 'hawat.blueprints.reports', 'hawat.blueprints.events', 'hawat.blueprints.detectors', 'hawat.blueprints.hosts', 'hawat.blueprints.timeline', 'hawat.blueprints.dnsr', 'hawat.blueprints.geoip', 'hawat.blueprints.whois', 'hawat.blueprints.performance', 'hawat.blueprints.status', 'hawat.blueprints.dbstatus', 'hawat.blueprints.users', 'hawat.blueprints.groups', 'hawat.blueprints.settings_reporting', 'hawat.blueprints.filters', 'hawat.blueprints.networks']
ENDPOINT_LOGIN = 'auth_dev.login'
EXPLAIN_TEMPLATE_LOADING = False
TESTING = True
hawat.config.get_app_root_relative_config()[source]

These configurations are relative to APP_ROOT_PATH environment setting and must be handled separately.

hawat.config.get_default_config_file()[source]

Get path to default configuration file based on the environment.