%PDF- %PDF-
Direktori : /opt/imunify360/venv/lib/python3.8/site-packages/defence360agent/application/ |
Current File : //opt/imunify360/venv/lib/python3.8/site-packages/defence360agent/application/settings.py |
""" This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Copyright © 2019 Cloud Linux Software Inc. This software is also available under ImunifyAV commercial license, see <https://www.imunify360.com/legal/eula> Set settings of application object""" from pathlib import Path from defence360agent import files from defence360agent.application import tags from defence360agent.contracts import eula from defence360agent.contracts.config import ANTIVIRUS_MODE from defence360agent.malwarelib import model as malwarelib_model from defence360agent.malwarelib.subsys import aibolit from defence360agent.model import simplification from defence360agent.simple_rpc.schema import init_validator from defence360agent.rpc_tools.validate import ( SchemaValidator, validate_middleware, ) from . import app async def update_eula_data(index, is_updated: bool): if is_updated: await eula.update() def configure( init_validator=init_validator, validator_cls=SchemaValidator, validate_middleware_wrap=validate_middleware, schema_paths=None, models_modules=None, set_sentry_tags=tags.fill, ): app.SCHEMA_PATHS = schema_paths app.VALIDATOR, app.MIDDLEWARE, app.MIDDLEWARE_EXCLUDE = init_validator( validator_cls, validate_middleware_wrap, schema_paths ) app.MODULES_WITH_MODELS += [simplification, malwarelib_model] if models_modules: app.MODULES_WITH_MODELS += models_modules av_path = Path(__file__).resolve().parent.parent app.MIGRATIONS_DIRS += [av_path / "migrations"] set_sentry_tags() files.configure() files.Index.add_hook(files.EULA, update_eula_data) if not ANTIVIRUS_MODE: files.Index.add_hook( files.REALTIME_AV_CONF, aibolit.restart_on_sigs_or_config_update, )