diff --git a/spiffworkflow-backend/bin/delete_and_import_all_permissions.py b/spiffworkflow-backend/bin/delete_and_import_all_permissions.py index 966ec5a11..09a7c1e0c 100644 --- a/spiffworkflow-backend/bin/delete_and_import_all_permissions.py +++ b/spiffworkflow-backend/bin/delete_and_import_all_permissions.py @@ -1,11 +1,11 @@ """Deletes all permissions and then re-imports from yaml file.""" -from spiffworkflow_backend import get_hacked_up_app_for_script +from spiffworkflow_backend import create_app from spiffworkflow_backend.services.authorization_service import AuthorizationService def main() -> None: """Main.""" - app = get_hacked_up_app_for_script() + app = create_app() with app.app_context(): AuthorizationService.delete_all_permissions() AuthorizationService.import_permissions_from_yaml_file() diff --git a/spiffworkflow-backend/bin/import_tickets_for_command_line.py b/spiffworkflow-backend/bin/import_tickets_for_command_line.py index 3b8005892..bea05a61d 100644 --- a/spiffworkflow-backend/bin/import_tickets_for_command_line.py +++ b/spiffworkflow-backend/bin/import_tickets_for_command_line.py @@ -1,7 +1,7 @@ """Grabs tickets from csv and makes process instances.""" import csv -from spiffworkflow_backend import get_hacked_up_app_for_script +from spiffworkflow_backend import create_app from spiffworkflow_backend.models.db import db from spiffworkflow_backend.models.process_instance import ProcessInstanceModel from spiffworkflow_backend.models.user import UserModel @@ -11,7 +11,7 @@ from spiffworkflow_backend.services.process_instance_service import ProcessInsta def main(): """Main.""" - app = get_hacked_up_app_for_script() + app = create_app() with app.app_context(): process_model_identifier_ticket = "ticket" db.session.query(ProcessInstanceModel).filter( diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py index 20d5992f1..d9285b9e0 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/__init__.py @@ -205,21 +205,6 @@ def _setup_prometheus_metrics(app: flask.app.Flask, connexion_app: connexion.app metrics.info("version_info", "Application Version Info", **version_info_data_normalized) -def get_hacked_up_app_for_script() -> flask.app.Flask: - os.environ["SPIFFWORKFLOW_BACKEND_ENV"] = "local_development" - flask_env_key = "FLASK_SESSION_SECRET_KEY" - os.environ[flask_env_key] = "whatevs" - if "SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR" not in os.environ: - home = os.environ["HOME"] - full_process_model_path = f"{home}/projects/github/sartography/sample-process-models" - if os.path.isdir(full_process_model_path): - os.environ["SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR"] = full_process_model_path - else: - raise Exception(f"Could not find {full_process_model_path}") - app = create_app() - return app - - def traces_sampler(sampling_context: Any) -> Any: # always inherit if sampling_context["parent_sampled"] is not None: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py index a14986bb0..80db070e1 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py @@ -184,6 +184,9 @@ def setup_config(app: Flask) -> None: setup_database_configs(app) setup_logger(app) + app.logger.debug( + f"SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR: {app.config['SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR']}" + ) if app.config["SPIFFWORKFLOW_BACKEND_DEFAULT_USER_GROUP"] == "": app.config["SPIFFWORKFLOW_BACKEND_DEFAULT_USER_GROUP"] = None