lib/liberty_buildpack/util/configuration_utils.rb
# 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(identifier, clean_nil_values = true, should_log = true)
          file = file_name(identifier)
          if file.exist?
            var_name      = environment_variable_name(identifier)
            user_provided = ENV[var_name]
            configuration = load_configuration(file, user_provided, var_name, clean_nil_values, should_log)
          elsif should_log
            logger.debug { "No configuration file #{file} found" }
          end
          configuration || {}
        end
def load ( identifier , clean_nil_values = true , should_log = true ) file = file_name ( identifier ) if file . exist? var_name = environment_variable_name ( identifier ) user_provided = ENV [ var_name ] configuration = load_configuration ( file , user_provided , var_name , clean_nil_values , should_log ) elsif should_log logger . debug { "No configuration file #{file} found" } end 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
identifier
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 .