<commit_before>require 'singleton'
require 'yaml'

module PowerDNS
  module DB
    class Config < Hash
      include Singleton

      PATH = '~/.config/PowerDNS/db_cli.yaml'

      DEFAULT = {
        adapter: 'postgresql',
        host: 'localhost',
        port: 5432,
        database: 'pdns',
        username: 'postgres',
        password: ''
      }

      def initialize
        if File.exists?(File.expand_path(PATH))
          self.merge!(YAML.load_file(PATH))
        else
          self.merge!(DEFAULT)
        end
      end
    end
  end
end<commit_msg>Expand config file path also on load.<commit_after>require 'singleton'
require 'yaml'

module PowerDNS
  module DB
    class Config < Hash
      include Singleton

      PATH = File.expand_path('~/.config/PowerDNS/db_cli.yaml')

      DEFAULT = {
        adapter: 'postgresql',
        host: 'localhost',
        port: 5432,
        database: 'pdns',
        username: 'postgres',
        password: ''
      }

      def initialize
        if File.exists?(PATH)
          self.merge!(YAML.load_file(PATH))
        else
          self.merge!(DEFAULT)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10311958405545928, 'fraction_numerical': 0.006932409012131715, 'mean_word_length': 1.858910891089109, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7294066', 'n_tokens_mistral': 361, 'n_tokens_neox': 345, 'n_words': 83}