cleanup and log SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR
This commit is contained in:
parent
b60b620f16
commit
0667436c15
|
@ -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()
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue