comparison mod_pubsub_github/mod_pubsub_github.lua @ 3525:8c1a3b989990

mod_pubsub_github: Rename variable to avoid name clash [luacheck]
author Kim Alvefur <zash@zash.se>
date Sun, 31 Mar 2019 18:31:57 +0200
parents c2e038e573be
children bcfd6e5bb0f5
comparison
equal deleted inserted replaced
3524:a7a751e57f32 3525:8c1a3b989990
16 -- configuration 16 -- configuration
17 local default_node = module:get_option("github_node", "github"); 17 local default_node = module:get_option("github_node", "github");
18 local node_prefix = module:get_option_string("github_node_prefix", "github/"); 18 local node_prefix = module:get_option_string("github_node_prefix", "github/");
19 local node_mapping = module:get_option_string("github_node_mapping"); 19 local node_mapping = module:get_option_string("github_node_mapping");
20 local github_actor = module:get_option_string("github_actor") or true; 20 local github_actor = module:get_option_string("github_actor") or true;
21 local secret = module:get_option("github_secret"); 21 local github_secret = module:get_option("github_secret");
22 22
23 -- validation 23 -- validation
24 assert(secret, "Please set 'github_secret'"); 24 assert(github_secret, "Please set 'github_secret'");
25 25
26 local error_mapping = { 26 local error_mapping = {
27 ["forbidden"] = 403; 27 ["forbidden"] = 403;
28 ["item-not-found"] = 404; 28 ["item-not-found"] = 404;
29 ["internal-server-error"] = 500; 29 ["internal-server-error"] = 500;
40 end 40 end
41 41
42 function handle_POST(event) 42 function handle_POST(event)
43 local request, response = event.request, event.response; 43 local request, response = event.request, event.response;
44 44
45 if not verify_signature(secret, request.body, request.headers.x_hub_signature) then 45 if not verify_signature(github_secret, request.body, request.headers.x_hub_signature) then
46 module:log("debug", "Signature validation failed"); 46 module:log("debug", "Signature validation failed");
47 return 401; 47 return 401;
48 end 48 end
49 49
50 local data = json.decode(request.body); 50 local data = json.decode(request.body);