Skip to content

Commit

Permalink
Add _WORKFLOW to some env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ssciolla committed May 9, 2024
1 parent 5d8aa56 commit 0897758
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
16 changes: 9 additions & 7 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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(
Expand Down

0 comments on commit 0897758

Please sign in to comment.