app_nocache(app) api = Api(app, version='1.0', title='Document service API', description="""API for QWC Document service. The document service delivers reports from the Jasper reporting service. """, default_label='Document operations', doc='/api/') app.config.SWAGGER_UI_DOC_EXPANSION = 'list' # disable verbose 404 error message app.config['ERROR_404_HELP'] = False auth = auth_manager(app, api) tenant_handler = TenantHandler(app.logger) config_handler = RuntimeConfig("document", app.logger) def get_document(tenant, template, format): """Return report with specified template and format. :param str template: Template ID :param str format: Document format """ config = config_handler.tenant_config(tenant) jasper_service_url = config.get('jasper_service_url', 'http://localhost:8002/reports') jasper_timeout = config.get("jasper_timeout", 60)
from qwc_services_core.tenant_handler import TenantHandler, \ TenantPrefixMiddleware, TenantSessionInterface from qwc_services_core.runtime_config import RuntimeConfig from qwc_services_core.database import DatabaseEngine from access_control import AccessControl from controllers import UsersController, GroupsController, RolesController, \ ResourcesController, PermissionsController, RegistrableGroupsController, \ RegistrationRequestsController AUTH_PATH = os.environ.get('AUTH_PATH', '/auth') SKIP_LOGIN = os.environ.get('SKIP_LOGIN', False) # Flask application app = Flask(__name__, template_folder='.') jwt = auth_manager(app) app.secret_key = app.config['JWT_SECRET_KEY'] app.config['QWC_GROUP_REGISTRATION_ENABLED'] = os.environ.get( 'GROUP_REGISTRATION_ENABLED', 'True') == 'True' app.config['IDLE_TIMEOUT'] = os.environ.get('IDLE_TIMEOUT', 0) # enable CSRF protection CSRFProtect(app) # load Bootstrap extension Bootstrap(app) # Setup mailer def mail_config_from_env(app): app.config['MAIL_SERVER'] = os.environ.get('MAIL_SERVER', '127.0.0.1')