Sha256: 0eb6d3939c70c93bd5bb8862920e67a493d42e3f11da582bcca9b27e87f064a2
Contents?: true
Size: 1.19 KB
Versions: 30
Compression:
Stored size: 1.19 KB
Contents
require File.expand_path('lib/foreman/dynflow/configuration', ::Rails.root) module ForemanTasks # Import all Dynflow configuration from Foreman, and add our own for Tasks class Dynflow::Configuration < ::Foreman::Dynflow::Configuration 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 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 def default_backup_dir File.join(Rails.root, 'tmp', 'task-backup') end 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 end end
Version data entries
30 entries across 30 versions & 1 rubygems