<commit_before># Hosted chef service instance.
app = 'oc_bifrost'

# In hosted chef we have a 'vips' data bag to find
# estatsd and DB.
vips = data_bag_item("vips", node[:app_environment])

# estatsd host is 1) node override or 2) VIP
node[app]['estatsd_host'] = if node['stats_hero'] && node['stats_hero']['estatsd_host']
   node['stats_hero']['estatsd_host']
else
  vips['estatsd_host']
end

# DB host is 1) node override or 2) VIP or 3) role query
node[app]['database']['host'] = if node[app]['database']['host']
  Chef::Log.info("Using node attribute for #{app} DB host")
  node[app]['database']['host']
elsif vips["bifrost_pgsql_ip"]
  Chef::Log.info("Using VIP for #{app} DB host")
  vips["bifrost_pgsql_ip"]
else
  Chef::Log.info("Using role search for #{app} DB host")
  search(:node, "role:bifrost-pgsql")[0].ipaddress
end

# Superuser ID is in the environments data bag
env = data_bag_item("environments", node[:app_environment])
node[app]['superuser_id'] = env['opscode-authz-superuser-id']

include_recipe "opscode-bifrost::api_server"
<commit_msg>Configure OHC service with passwords from secrets data bag.<commit_after># Hosted chef service instance.
app = 'oc_bifrost'

# In hosted chef we have a 'vips' data bag to find
# estatsd and DB.
vips = data_bag_item("vips", node[:app_environment])

# estatsd host is 1) node override or 2) VIP
node[app]['estatsd_host'] = if node['stats_hero'] && node['stats_hero']['estatsd_host']
   node['stats_hero']['estatsd_host']
else
  vips['estatsd_host']
end

# DB host is 1) node override or 2) VIP or 3) role query
node[app]['database']['host'] = if node[app]['database']['host']
  Chef::Log.info("Using node attribute for #{app} DB host")
  node[app]['database']['host']
elsif vips["bifrost_pgsql_ip"]
  Chef::Log.info("Using VIP for #{app} DB host")
  vips["bifrost_pgsql_ip"]
else
  Chef::Log.info("Using role search for #{app} DB host")
  search(:node, "role:bifrost-pgsql")[0].ipaddress
end

# Superuser ID is in the environments data bag
env = data_bag_item("environments", node[:app_environment])
node[app]['superuser_id'] = env['opscode-authz-superuser-id']

# DB passwords are in the secrets data bag.
secrets = data_bag_item("secrets", node[:app_environment])
node[app]['database']['users']['owner']['password'] = secrets[app]['db_rw_password']
node[app]['database']['users']['read_only']['password'] = secrets[app]['db_ro_password']

include_recipe "opscode-bifrost::api_server"

{'fraction_non_alphanumeric': 0.16530278232405893, 'fraction_numerical': 0.004909983633387889, 'mean_word_length': 6.616822429906542, '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': '2084979', 'n_tokens_mistral': 876, 'n_tokens_neox': 855, 'n_words': 223}