<commit_before>module VMDB
  class Config
    include Vmdb::Logging

    @@sync_cfile = Sync.new
    @@cached_configs = {}

    require_relative 'configuration_encoder'

    def self.deep_clean_auth_for_log(log_auth)
      log_auth.each do |key, val|
        log_auth[key] = deep_clean_auth_for_log(val) if val.kind_of?(Hash)

        log_auth[key] = "********" if [:bind_pwd, :amazon_secret].include? key

        log_auth[key].each do |p|
          p.each { |key2, _val2| p[key2] = "********" if [:bind_pwd, :amazon_secret].include? key2 }
        end if [:user_proxies].include? key
      end
      log_auth
    end

    def self.clone_auth_for_log(auth)
      deep_clean_auth_for_log(auth.deep_clone)
    end

    def self.invalidate(name)
      @@cached_configs.delete(name)
    end

    def self.invalidate_all
      invalidate_configuration_source
      @@cached_configs.clear
    end

    def self.invalidate_configuration_source<commit_msg>DRY password key list<commit_after>module VMDB
  class Config
    include Vmdb::Logging

    @@sync_cfile = Sync.new
    @@cached_configs = {}

    require_relative 'configuration_encoder'


    PASSWORD_KEYS = [:bind_pwd, :amazon_secret]

    def self.deep_clean_auth_for_log(log_auth)
      log_auth.each do |key, val|
        log_auth[key] = deep_clean_auth_for_log(val) if val.kind_of?(Hash)

        log_auth[key] = "********" if PASSWORD_KEYS.include? key

        log_auth[key].each do |p|
          p.each { |key2, _val2| p[key2] = "********" if PASSWORD_KEYS.include? key2 }
        end if [:user_proxies].include? key
      end
      log_auth
    end

    def self.clone_auth_for_log(auth)
      deep_clean_auth_for_log(auth.deep_clone)
    end

    def self.invalidate(name)
      @@cached_configs.delete(name)
    end

    def self.invalidate_all
      invalidate_configuration_source
      @@cached_configs.clear
    end

    def self.invalidate_configuration_source
{'fraction_non_alphanumeric': 0.10892116182572614, 'fraction_numerical': 0.004149377593360996, 'mean_word_length': 3.069620253164557, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4581490', 'n_tokens_mistral': 696, 'n_tokens_neox': 670, 'n_words': 121}