lib/liberty_buildpack/util/configuration_utils.rb
def load_configuration(file, user_provided, var_name, clean_nil_values, should_log)
          configuration = YAML.load_file(file)
          logger.debug { "Configuration from #{file}: #{configuration}" } if should_log

          if user_provided
            begin
              user_provided_value = YAML.load(user_provided)
              configuration       = merge_configuration(configuration, user_provided_value, var_name, should_log)
            rescue Psych::SyntaxError => ex
              raise "User configuration value in environment variable #{var_name} has invalid syntax: #{ex}"
            end
            logger.debug { "Configuration from #{file} modified with: #{user_provided}" } if should_log
          end

          clean_nil_values configuration if clean_nil_values && !configuration.nil?
          configuration
        end
# Loads a configuration file from the buildpack configuration directory.  If the configuration file does not
# exist, returns an empty hash. Overlays configuration in a matching environment variable, on top of the loaded
# configuration, if present. Will not add a new configuration key where an existing one does not exist.
#
# @param [String] identifier the identifier of the configuration to load
# @param [Boolean] clean_nil_values whether empty/nil values should be removed along with their keys from the
#                                  returned configuration.
# @param [Boolean] should_log whether the contents of the configuration file should be logged.  This value
#                             should be left to its default and exists to allow the logger to use the utility.
# @return [Hash] the configuration or an empty hash if the configuration file does not exist
Loads a configuration file from the buildpack configuration directory.  If the configuration file does not
exist, returns an empty hash. Overlays configuration in a matching environment variable, on top of the loaded
configuration, if present. Will not add a new configuration key where an existing one does not exist.
Loads a configuration file from the buildpack configuration directory . If the configuration file does not exist returns an empty hash . Overlays configuration in a matching environment variable on top of the loaded configuration if present . Will not add a new configuration key where an existing one does not exist .
def load_configuration(file, user_provided, var_name, clean_nil_values, should_log)
          configuration = YAML.load_file(file)
          logger.debug { "Configuration from #{file}: #{configuration}" } if should_log
          if user_provided
            begin
              user_provided_value = YAML.load(user_provided)
              configuration       = merge_configuration(configuration, user_provided_value, var_name, should_log)
            rescue Psych::SyntaxError => ex
              raise "User configuration value in environment variable #{var_name} has invalid syntax: #{ex}"
            end
            logger.debug { "Configuration from #{file} modified with: #{user_provided}" } if should_log
          end
          clean_nil_values configuration if clean_nil_values && !configuration.nil?
          configuration
        end
def load_configuration ( file , user_provided , var_name , clean_nil_values , should_log ) configuration = YAML . load_file ( file ) logger . debug { "Configuration from #{file}: #{configuration}" } if should_log if user_provided begin user_provided_value = YAML . load ( user_provided ) configuration = merge_configuration ( configuration , user_provided_value , var_name , should_log ) rescue Psych :: SyntaxError => ex raise "User configuration value in environment variable #{var_name} has invalid syntax: #{ex}" end logger . debug { "Configuration from #{file} modified with: #{user_provided}" } if should_log end clean_nil_values configuration if clean_nil_values && ! configuration . nil? configuration end
Loads a configuration file from the buildpack configuration directory.
Loads a configuration file from the buildpack configuration directory .
the configuration or an empty hash if the configuration file does not exist
the configuration or an empty hash if the configuration file does not exist
Hash
file
user_provided
var_name
clean_nil_values
should_log
should_log whether the contents of the configuration file should be logged. This value should be left to its default and exists to allow the logger to use the utility.
should_log whether the contents of the configuration file should be logged . This value should be left to its default and exists to allow the logger to use the utility .