diff --git a/spiffworkflow-backend/bin/run_server_locally b/spiffworkflow-backend/bin/run_server_locally index 674435515..7d1f3be9d 100755 --- a/spiffworkflow-backend/bin/run_server_locally +++ b/spiffworkflow-backend/bin/run_server_locally @@ -7,10 +7,15 @@ function error_handler() { trap 'error_handler ${LINENO} $?' ERR set -o errtrace -o errexit -o nounset -o pipefail +port="${SPIFFWORKFLOW_BACKEND_PORT:-7000}" + arg="${1:-}" if [[ "$arg" == "acceptance" ]]; then export SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA=true export SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME=acceptance_tests.yml +elif [[ "$arg" == "localopenid" ]]; then + export SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL="http://localhost:$port/openid" + export SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME="example.yml" fi if [[ -z "${SPIFFWORKFLOW_BACKEND_ENV:-}" ]]; then @@ -38,5 +43,5 @@ else fi # this line blocks - SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER="${SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER}" FLASK_APP=src/spiffworkflow_backend poetry run flask run -p 7000 + SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER="${SPIFFWORKFLOW_BACKEND_RUN_BACKGROUND_SCHEDULER}" FLASK_APP=src/spiffworkflow_backend poetry run flask run -p "$port" fi diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py index f6a1a897b..8804b3d15 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py @@ -62,13 +62,16 @@ SPIFFWORKFLOW_BACKEND_OPEN_ID_CLIENT_SECRET_KEY = environ.get( default="JXeQExm0JhQPLumgHtIIqf52bDalHz0q", ) # noqa: S105 -# Tenant specific fields is a comma separated list of field names that we will convert to list of strings +# Tenant specific fields is a comma separated list of field names that we will be converted to list of strings # and store in the user table's tenant_specific_field_n columns. You can have up to three items in this # comma-separated list. SPIFFWORKFLOW_BACKEND_OPEN_ID_TENANT_SPECIFIC_FIELDS = environ.get( "SPIFFWORKFLOW_BACKEND_OPEN_ID_TENANT_SPECIFIC_FIELDS" ) +# loggers to use is a comma separated list of logger prefixes that we will be converted to list of strings +SPIFFWORKFLOW_BACKEND_LOGGERS_TO_USE = environ.get("SPIFFWORKFLOW_BACKEND_LOGGERS_TO_USE") + # cryptography or simple-crypt SPIFFWORKFLOW_BACKEND_ENCRYPTION_LIB = environ.get( # "SPIFFWORKFLOW_BACKEND_ENCRYPTION_LIB", default="cryptography" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/demo.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/demo.yml index 8d2008e40..dbded55bb 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/demo.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/demo.yml @@ -22,4 +22,3 @@ permissions: users: [] allowed_permissions: [create, read, update, delete] uri: /* - diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py index 3a5ee845b..82b858beb 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py @@ -129,8 +129,27 @@ def setup_logger(app: Flask) -> None: spiff_logger_filehandler.setFormatter(log_formatter) # these loggers have been deemed too verbose to be useful - garbage_loggers_to_exclude = ["connexion", "flask_cors.extension"] - loggers_to_exclude_from_debug = ["sqlalchemy"] + garbage_loggers_to_exclude = ["connexion", "flask_cors.extension", "flask_cors.core", "sqlalchemy"] + + # if you actually want one of these excluded loggers, there is a config option to turn it on + loggers_to_use = app.config.get("SPIFFWORKFLOW_BACKEND_LOGGERS_TO_USE", []) + if loggers_to_use is None or loggers_to_use == "": + loggers_to_use = [] + else: + loggers_to_use = loggers_to_use.split(",") + for logger_to_use in loggers_to_use: + if logger_to_use in garbage_loggers_to_exclude: + garbage_loggers_to_exclude.remove(logger_to_use) + else: + app.logger.warning( + f"Logger '{logger_to_use}' not found in garbage_loggers_to_exclude. You do not need to add it to" + " SPIFFWORKFLOW_BACKEND_LOGGERS_TO_USE." + ) + + loggers_to_exclude_from_debug = [] + + if "sqlalchemy" not in garbage_loggers_to_exclude: + loggers_to_exclude_from_debug.append("sqlalchemy") # make all loggers act the same for name in logging.root.manager.loggerDict: