class Object

Constants

CONFIG_FILE

Public Instance Methods

load_default_config(file_path) click to toggle source

Set values in global settings based on config

# File lib/file_sv.rb, line 32
def load_default_config(file_path)
  return unless File.exist? file_path

  config = YAML.load_file file_path
  return unless config # Handle empty YAML file

  config["global"]&.each do |key, value|
    GlobalSettings.send("#{key}=", value)
  end

  load_rest_method_config config
end
load_rest_method_config(config) click to toggle source

Load details of each REST method

# File lib/file_sv.rb, line 46
def load_rest_method_config(config)
  FileSv.rest_methods.each do |method, setting_class|
    config[method.to_s]&.each { |key, value| setting_class.send("#{key}=", value) }
  end
end
set_based_on_env_vars() click to toggle source

Set global params based on ENV vars

# File lib/file_sv.rb, line 53
def set_based_on_env_vars
  GlobalSettings.instance_variables.each do |setting|
    setting_name = setting.to_s[1..-1]
    if ENV[setting_name]
      puts "Setting #{setting_name} to #{ENV[setting_name]}"
      GlobalSettings.send("#{setting_name}=", ENV[setting_name])
    end
  end
end