From 03c7940f1c02491caeff6d1d7be164b658b6bad2 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Sat, 12 Feb 2022 10:53:45 -0600 Subject: [PATCH] Fix Webhooks for Drone not working in Gitea 1.16 By default, only external requests are allowed: https://github.com/go-gitea/gitea/pull/17482 --- site-cookbooks/kosmos_gitea/attributes/default.rb | 6 ++++++ site-cookbooks/kosmos_gitea/recipes/default.rb | 3 ++- site-cookbooks/kosmos_gitea/templates/default/app.ini.erb | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/site-cookbooks/kosmos_gitea/attributes/default.rb b/site-cookbooks/kosmos_gitea/attributes/default.rb index a8b66f4..7a6b5d0 100644 --- a/site-cookbooks/kosmos_gitea/attributes/default.rb +++ b/site-cookbooks/kosmos_gitea/attributes/default.rb @@ -4,3 +4,9 @@ node.default["kosmos_gitea"]["binary_url"] = "https://dl.gitea.io/gitea/#{gitea_ node.default["kosmos_gitea"]["binary_checksum"] = "f03f3a3c4dccc2219351cde5c9af372715b2ec3e88a821779702bc6f38084c97" node.default["kosmos_gitea"]["nginx"]["domain"] = "gitea.kosmos.org" node.default["kosmos_gitea"]["working_directory"] = "/var/lib/gitea" + +node.default["kosmos_gitea"]["config"] = { + "webhook": { + "allowed_host_list" => "external,127.0.1.1" + } +} diff --git a/site-cookbooks/kosmos_gitea/recipes/default.rb b/site-cookbooks/kosmos_gitea/recipes/default.rb index 9a2bddf..c059fa3 100644 --- a/site-cookbooks/kosmos_gitea/recipes/default.rb +++ b/site-cookbooks/kosmos_gitea/recipes/default.rb @@ -90,7 +90,8 @@ template "#{config_directory}/app.ini" do postgresql_password: gitea_data_bag_item["postgresql_password"], smtp_host: smtp_credentials["relayhost"], smtp_user: smtp_credentials["user_name"], - smtp_password: smtp_credentials["password"] + smtp_password: smtp_credentials["password"], + config: node["kosmos_gitea"]["config"] notifies :restart, "service[gitea]", :delayed end diff --git a/site-cookbooks/kosmos_gitea/templates/default/app.ini.erb b/site-cookbooks/kosmos_gitea/templates/default/app.ini.erb index e013a0d..1d43c86 100644 --- a/site-cookbooks/kosmos_gitea/templates/default/app.ini.erb +++ b/site-cookbooks/kosmos_gitea/templates/default/app.ini.erb @@ -85,3 +85,8 @@ ALLOWED_TYPES = image/gif|image/jpeg|image/png|application/zip|application/gzip MAX_SIZE = 10 ; ; Max number of files per upload. Defaults to 5 MAX_FILES = 5 + +<% if c = @config["webhook"] %> +[webhook] +<% if c["allowed_host_list"] %>ALLOWED_HOST_LIST = <%= c["allowed_host_list"] %><% end %> +<% end %>