# File src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb, line 78
      def load_config_file(filename)
        if !defined?(PhusionPassenger::Utils::JSON)
          PhusionPassenger.require_passenger_lib 'utils/json'
        end
        begin
          data = File.open(filename, "r:utf-8") do |f|
            f.read
          end
        rescue SystemCallError => e
          raise ConfigLoadError, "cannot load config file #{filename} (#{e})"
        end

        begin
          config = PhusionPassenger::Utils::JSON.parse(data)
        rescue => e
          raise ConfigLoadError, "cannot parse config file #{filename} (#{e})"
        end
        if !config.is_a?(Hash)
          raise ConfigLoadError, "cannot parse config file #{filename} (it does not contain an object)"
        end

        result = {}
        config_file_dir = File.dirname(File.absolute_logical_path(filename))
        config.each_pair do |key, val|
          key = key.to_sym
          spec_item = CONFIG_NAME_INDEX[key]
          if spec_item
            begin
              result[key] = parse_config_value(spec_item, val, config_file_dir)
            rescue ConfigLoadError => e
              raise ConfigLoadError, "cannot parse config file #{filename} " \
                "(error in config option '#{key}': #{e.message})"
            end
          else
            STDERR.puts "*** WARNING: #{filename}: configuration key '#{key}' is not supported"
            result[key] = val
          end
        end

        result
      end