<commit_before># Override attributes from data bag's "web" section
begin
  secrets = Chef::EncryptedDataBagItem.load(node.graylog2[:secrets_data_bag], 'graylog')['web']
rescue
  Chef::Log.debug 'Can not merge web secrets from databag'
end
Chef::Mixin::DeepMerge.deep_merge!(secrets, node.override[:graylog2]) unless secrets.nil?
Chef::Application.fatal!('No password_secret set, either set it via an attribute or in the encrypted data bag in secrets.graylog') unless node.graylog2[:web][:secret]

package 'graylog-web' do
  action :install
  version node.graylog2[:web][:version]
  options '--force-yes' if platform?('debian')
  options '-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"' if node.platform_family == 'debian'
  notifies :restart, 'service[graylog-web]', node.graylog2[:restart].to_sym
end

service 'graylog-web' do
  action :nothing
  supports :status => true, :restart => true
  restart_command node.graylog2[:web][:override_restart_command] if node.graylog2[:web][:override_restart_command]
  provider Chef::Provider::Service::Upstart if platform?('ubuntu')
end

default_backend_uri = "http://#{node[:ipaddress]}:12900/"

template '/etc/graylog/web/web.conf' do
  source 'graylog.web.conf.erb'
  owner 'root'
  group node.graylog2[:web][:group]
  mode 0640
  variables(<commit_msg>Fixes deep merging of web attrs from data bag<commit_after># Override attributes from data bag's "web" section
begin
  secrets = Chef::EncryptedDataBagItem.load(node.graylog2[:secrets_data_bag], 'graylog')['web']
rescue
  Chef::Log.debug 'Can not merge web secrets from databag'
end
Chef::Mixin::DeepMerge.deep_merge!(secrets, node.override[:graylog2][:web]) unless secrets.nil?
Chef::Application.fatal!('No web secret set, either set it via an attribute or in the encrypted data bag in secrets.graylog') unless node.graylog2[:web][:secret]

package 'graylog-web' do
  action :install
  version node.graylog2[:web][:version]
  options '--force-yes' if platform?('debian')
  options '-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"' if node.platform_family == 'debian'
  notifies :restart, 'service[graylog-web]', node.graylog2[:restart].to_sym
end

service 'graylog-web' do
  action :nothing
  supports :status => true, :restart => true
  restart_command node.graylog2[:web][:override_restart_command] if node.graylog2[:web][:override_restart_command]
  provider Chef::Provider::Service::Upstart if platform?('ubuntu')
end

default_backend_uri = "http://#{node[:ipaddress]}:12900/"

template '/etc/graylog/web/web.conf' do
  source 'graylog.web.conf.erb'
  owner 'root'
  group node.graylog2[:web][:group]
  mode 0640
  variables(
{'fraction_non_alphanumeric': 0.14744307577454274, 'fraction_numerical': 0.01269130272489735, 'mean_word_length': 6.127659574468085, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2587928', 'n_tokens_mistral': 923, 'n_tokens_neox': 891, 'n_words': 212}