From 0897758eb5ed74c221427e4436deb84845f26373 Mon Sep 17 00:00:00 2001 From: Samuel Sciolla Date: Thu, 9 May 2024 15:12:16 -0400 Subject: [PATCH] Add _WORKFLOW to some env vars --- example.env | 16 +++++++++------- lib/config.rb | 9 +++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/example.env b/example.env index 2925000..8a1319d 100644 --- a/example.env +++ b/example.env @@ -3,18 +3,20 @@ # Settings # One of info, debug, error, warn, trace, fatal SETTINGS_LOG_LEVEL=debug -# Directory paths should be absolute or relative to root -SETTINGS_WORKING_DIR=./prep -SETTINGS_EXPORT_DIR=./export -# Determines whether to remove tar files from export, either true or false (should be true in production) -SETTINGS_REMOVE_EXPORT=true -# Determines whether the process skips sending bag(s) -SETTINGS_DRY_RUN=false + # Limit for the size (in bytes) of objects to be processed (optional) # This is useful for development or in environments where larger files cannot be processed. SETTINGS_OBJECT_SIZE_LIMIT= # Number of objects per repository (e.g. Archivematica instance) to process at once (optional) SETTINGS_NUM_OBJECTS_PER_REPOSITORY= +# Workflow +# Directory paths should be absolute or relative to root +SETTINGS_WORKFLOW_WORKING_DIR=./prep +SETTINGS_WORKFLOW_EXPORT_DIR=./export +# Determines whether to remove tar files from export, either true or false (should be true in production) +SETTINGS_WORKFLOW_REMOVE_EXPORT=true +# Determines whether the process skips sending bag(s) +SETTINGS_WORKFLOW_DRY_RUN=false # Repository # Name that will be used for the repository at the beginning of bag identifiers diff --git a/lib/config.rb b/lib/config.rb index 24f46c9..c17a884 100644 --- a/lib/config.rb +++ b/lib/config.rb @@ -277,6 +277,7 @@ def self.create_archivematica_config(data) def self.create_config(data) data = CheckableData.new(data) + settings_workflow_data = data.get_subset_by_key_stem("SETTINGS_WORKFLOW_") db_data = data.get_subset_by_key_stem("DATABASE_") arch_configs = [] @@ -295,10 +296,10 @@ def self.create_config(data) key: "SETTINGS_NUM_OBJECTS_PER_REPOSITORY", checks: [IntegerCheck.new], optional: true )&.to_i, workflow: WorkflowConfig.new( - working_dir: data.get_value(key: "SETTINGS_WORKING_DIR"), - export_dir: data.get_value(key: "SETTINGS_EXPORT_DIR"), - dry_run: data.get_value(key: "SETTINGS_DRY_RUN", checks: [BOOLEAN_CHECK]) == "true", - remove_export: data.get_value(key: "SETTINGS_REMOVE_EXPORT", checks: [BOOLEAN_CHECK]) == "true" + working_dir: settings_workflow_data.get_value(key: "WORKING_DIR"), + export_dir: settings_workflow_data.get_value(key: "EXPORT_DIR"), + dry_run: settings_workflow_data.get_value(key: "DRY_RUN", checks: [BOOLEAN_CHECK]) == "true", + remove_export: settings_workflow_data.get_value(key: "REMOVE_EXPORT", checks: [BOOLEAN_CHECK]) == "true" ) ), repository: RepositoryConfig.new(