class ForemanTasks::Dynflow::Configuration
Import all Dynflow
configuration from Foreman, and add our own for Tasks
Public Instance Methods
backup_settings()
click to toggle source
# File lib/foreman_tasks/dynflow/configuration.rb, line 13 def backup_settings return @backup_settings if @backup_settings backup_options = { :backup_deleted_plans => true, :backup_dir => default_backup_dir, } settings = SETTINGS.dig(:'foreman-tasks', :backup) backup_options.merge!(settings) if settings @backup_settings = with_environment_override backup_options end
default_backup_dir()
click to toggle source
# File lib/foreman_tasks/dynflow/configuration.rb, line 24 def default_backup_dir File.join(Rails.root, 'tmp', 'task-backup') end
with_environment_override(options)
click to toggle source
# File lib/foreman_tasks/dynflow/configuration.rb, line 28 def with_environment_override(options) env_var = ENV['TASK_BACKUP'] unless env_var.nil? # Everything except 0, n, no, false is considered to be a truthy value options[:backup_deleted_plans] = !%w[0 n no false].include?(env_var.downcase) end options end
world_config()
click to toggle source
Calls superclass method
# File lib/foreman_tasks/dynflow/configuration.rb, line 6 def world_config super.tap do |config| config.backup_deleted_plans = backup_settings[:backup_deleted_plans] config.backup_dir = backup_settings[:backup_dir] end end