<commit_before><%
deployment_path = File.expand_path('../../deployment.rb', __FILE__)
deployment_path = File.expand_path('../../../../deployment.rb', __FILE__) unless File.file?(deployment_path)
require deployment_path

# TODO: Rails 4.1 may be able to be configured with the database url
# instead of having to parse it here. Actually 4.0 can do that too but
# it doesn't work with the way seamless_database_pool wants to
# configure the read pool

writer = URI.parse(CDO.dashboard_db_writer) if CDO.dashboard_db_writer
reader = URI.parse(CDO.dashboard_db_reader) if CDO.dashboard_db_reader
%>

mysql_defaults: &mysql_defaults
  adapter: seamless_database_pool
  pool_adapter: mysql2
  encoding: utf8
  pool: 5
  master:
    username: <%= writer.user || 'root' %>
    password: <%= <PASSWORD> || '' %>
    host: <%= writer.host || 'localhost' %>
    database: <%= writer.path.sub(%r{^/},"") || "dashboard_#{Rails.env}" %>
  <% if reader %>
  read_pool:
   - username: <%= reader.user %>
     password: <%= <PASSWORD> %>
     host: <%= reader.host %>
     database: <%= reader.path.sub(%r{^/},"") %>
  <% end %>

development:
  <<: *mysql_defaults

staging: &staging
  <<: *mysql_defaults

# levelbuilder environment extends the staging environment
levelbuilder:
  <<: *staging

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  encoding: utf8
  username: 'root'
  host: 'localhost'
  password: ''
  pool: 5
  database: 'dashboard_test'

production:
  <<: *mysql_defaults
<commit_msg>disable reader if the reader and writer are the same host<commit_after><%
deployment_path = File.expand_path('../../deployment.rb', __FILE__)
deployment_path = File.expand_path('../../../../deployment.rb', __FILE__) unless File.file?(deployment_path)
require deployment_path

# TODO: Rails 4.1 may be able to be configured with the database url
# instead of having to parse it here. Actually 4.0 can do that too but
# it doesn't work with the way seamless_database_pool wants to
# configure the read pool

writer = URI.parse(CDO.dashboard_db_writer) if CDO.dashboard_db_writer
reader = URI.parse(CDO.dashboard_db_reader) if CDO.dashboard_db_reader
%>

mysql_defaults: &mysql_defaults
  adapter: seamless_database_pool
  pool_adapter: mysql2
  encoding: utf8
  pool: 5
  master:
    username: <%= writer.user || 'root' %>
    password: <%= <PASSWORD> || '' %>
    host: <%= writer.host || 'localhost' %>
    database: <%= writer.path.sub(%r{^/},"") || "dashboard_#{Rails.env}" %>
  <% if reader && reader.host != writer.host %>
  read_pool:
   - username: <%= reader.user %>
     password: <%= <PASSWORD> %>
     host: <%= reader.host %>
     database: <%= reader.path.sub(%r{^/},"") %>
  <% end %>

development:
  <<: *mysql_defaults

staging: &staging
  <<: *mysql_defaults

# levelbuilder environment extends the staging environment
levelbuilder:
  <<: *staging

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  encoding: utf8
  username: 'root'
  host: 'localhost'
  password: ''
  pool: 5
  database: 'dashboard_test'

production:
  <<: *mysql_defaults

{'fraction_non_alphanumeric': 0.139218009478673, 'fraction_numerical': 0.005924170616113744, 'mean_word_length': 4.078195488721804, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 29, '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': '5873899', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1052, 'n_words': 318}